summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-15.js
blob: e6035dd8e39481035887af1bf6307bfb5e783702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Globals marked as invisibleToDebugger behave appropriately.

load(libdir + "asserts.js");

var dbg = new Debugger;
var log = '';
dbg.onNewGlobalObject = function (global) {
  log += 'n';
}

assertEq(typeof newGlobal(), "object");
assertEq(typeof newGlobal({invisibleToDebugger: false}), "object");
assertEq(log, 'nn');

log = '';
assertEq(typeof newGlobal({newCompartment: true, invisibleToDebugger: true}), "object");
assertEq(log, '');

assertThrowsInstanceOf(() => dbg.addDebuggee(newGlobal({newCompartment: true, invisibleToDebugger: true})),
                       Error);

var glob = newGlobal({newCompartment: true, invisibleToDebugger: true});
dbg.addAllGlobalsAsDebuggees();
dbg.onDebuggerStatement = function (frame) { assertEq(true, false); };
glob.eval('debugger');