summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/noExecute-01.js
blob: 9933421418d52f689c9e5b894464a69cd367389d (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();
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);