Debian Codegraph @

js/src/jit-test/tests/debug/Debugger-ctor-02.js

raw
1 // Test creating a Debugger in a sandbox, debugging the initial global.
2
3 load(libdir + 'asserts.js');
4
5 var g = newGlobal({newCompartment: true});
6 g.debuggeeGlobal = this;
7 g.eval("var dbg = new Debugger(debuggeeGlobal);");
8 assertEq(g.eval("dbg instanceof Debugger"), true);
9
10 // The Debugger constructor from this compartment will not accept as its argument
11 // an Object from this compartment. Shenanigans won't fool the membrane.
12 g.parent = this;
13 assertThrowsInstanceOf(function () { g.eval("parent.Debugger(parent.Object())"); }, TypeError);