js/src/jit-test/tests/debug/cross-context-1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/cross-context-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// frame.eval can evaluate code in a frame pushed in another context. Bug 749697.
     1.5 +
     1.6 +// In other words, the debugger can see all frames on the stack, even though
     1.7 +// each frame is attached to a particular JSContext and multiple JSContexts may
     1.8 +// have frames on the stack.
     1.9 +
    1.10 +var g = newGlobal();
    1.11 +g.eval('function f(a) { debugger; evaluate("debugger;", {newContext: true}); }');
    1.12 +
    1.13 +var dbg = new Debugger(g);
    1.14 +var hits = 0;
    1.15 +dbg.onDebuggerStatement = function (frame1) {
    1.16 +    dbg.onDebuggerStatement = function (frame2) {
    1.17 +        assertEq(frame1.eval("a").return, 31);
    1.18 +        hits++;
    1.19 +    };
    1.20 +};
    1.21 +
    1.22 +g.f(31);
    1.23 +assertEq(hits, 1);

mercurial