diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/debug/Debugger-ctor-02.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/debug/Debugger-ctor-02.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,17 @@ +// |jit-test| debug +// Test creating a Debugger in a sandbox, debugging the initial global. +// +// This requires debug mode to already be on in the initial global, since it's +// always on the stack in the shell. Hence the |jit-test| tag. + +load(libdir + 'asserts.js'); + +var g = newGlobal(); +g.debuggeeGlobal = this; +g.eval("var dbg = new Debugger(debuggeeGlobal);"); +assertEq(g.eval("dbg instanceof Debugger"), true); + +// The Debugger constructor from this compartment will not accept as its argument +// an Object from this compartment. Shenanigans won't fool the membrane. +g.parent = this; +assertThrowsInstanceOf(function () { g.eval("parent.Debugger(parent.Object())"); }, TypeError);