PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js

http://github.com/zpao/v8monkey
JavaScript | 18 lines | 15 code | 2 blank | 1 comment | 0 complexity | df8af25f8970145bec31fa8df7a9b9d7 MD5 | raw file
 1// evalWithBindings to call a method of a debuggee object
 2var g = newGlobal('new-compartment');
 3var dbg = new Debugger;
 4var global = dbg.addDebuggee(g);
 5var hits = 0;
 6dbg.onDebuggerStatement = function (frame) {
 7    var obj = frame.arguments[0];
 8    var expected = frame.arguments[1];
 9    assertEq(frame.evalWithBindings("obj.toString()", {obj: obj}).return, expected);
10    hits++;
11};
12
13g.eval("function f(obj, expected) { debugger; }");
14
15g.eval("f(new Number(-0), '0');");
16g.eval("f(new String('ok'), 'ok');");
17g.eval("f({toString: function () { return f; }}, f);");
18assertEq(hits, 3);