blob: f769f04d84eecdb6385f13029d25ccea2c65588d (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Tests that NX works through the enabled toggle and adding/removing the
// global.
load(libdir + "asserts.js");
load(libdir + "debuggerNXHelper.js");
var g = newGlobal();
var dbg = new Debugger(g);
g.eval(`
function f() { }
var o = {
get p() { },
set p(x) { }
};
`);
var handlers = [() => { g.f(); },
() => { g.o.p } ,
() => { g.o.p = 42; }];
function testHookEnabled(hookName, trigger) {
for (var h of handlers) {
assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
dbg.enabled = false;
h();
dbg.enabled = true;
assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
}
}
function testHookRemoval(hookName, trigger) {
for (var h of handlers) {
assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
dbg.removeDebuggee(g);
h();
dbg.addDebuggee(g);
assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
}
}
testDebuggerHooksNX(dbg, g, testHookEnabled);
testDebuggerHooksNX(dbg, g, testHookRemoval);
|