summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/noExecute-01.js
blob: 09f6ba41a7f936b57e8d410bc0729c40fb4c640b (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
// Tests that NX disallows debuggee execution for all the hooks.

load(libdir + "asserts.js");
load(libdir + "debuggerNXHelper.js");

var g = newGlobal({newCompartment: true});
var dbg = new Debugger(g);

// Attempts to call g.f without going through an invocation function should
// throw.
g.eval(`
       function f() { }
       var o = {
         get p() { },
         set p(x) { }
       };
       `);

var handlers = [() => { g.f(); },
                () => { g.o.p } ,
                () => { g.o.p = 42; }];

function testHook(hookName) {
  for (var h of handlers) {
    assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
  }
}

testDebuggerHooksNX(dbg, g, testHook);