summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-ctor-02.js
blob: f1e4afdba95eb88e9009991b775e64bc3c5dda4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Test creating a Debugger in a sandbox, debugging the initial global.

load(libdir + 'asserts.js');

var g = newGlobal({newCompartment: true});
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);