js/src/jit-test/tests/debug/Debugger-ctor-02.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/Debugger-ctor-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +// |jit-test| debug
     1.5 +// Test creating a Debugger in a sandbox, debugging the initial global.
     1.6 +//
     1.7 +// This requires debug mode to already be on in the initial global, since it's
     1.8 +// always on the stack in the shell. Hence the |jit-test| tag.
     1.9 +
    1.10 +load(libdir + 'asserts.js');
    1.11 +
    1.12 +var g = newGlobal();
    1.13 +g.debuggeeGlobal = this;
    1.14 +g.eval("var dbg = new Debugger(debuggeeGlobal);");
    1.15 +assertEq(g.eval("dbg instanceof Debugger"), true);
    1.16 +
    1.17 +// The Debugger constructor from this compartment will not accept as its argument
    1.18 +// an Object from this compartment. Shenanigans won't fool the membrane.
    1.19 +g.parent = this;
    1.20 +assertThrowsInstanceOf(function () { g.eval("parent.Debugger(parent.Object())"); }, TypeError);

mercurial