tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

noExecute-01.js (678B)


      1 // Tests that NX disallows debuggee execution for all the hooks.
      2 
      3 load(libdir + "asserts.js");
      4 load(libdir + "debuggerNXHelper.js");
      5 
      6 var g = newGlobal({newCompartment: true});
      7 var dbg = new Debugger(g);
      8 
      9 // Attempts to call g.f without going through an invocation function should
     10 // throw.
     11 g.eval(`
     12       function f() { }
     13       var o = {
     14         get p() { },
     15         set p(x) { }
     16       };
     17       `);
     18 
     19 var handlers = [() => { g.f(); },
     20                () => { g.o.p } ,
     21                () => { g.o.p = 42; }];
     22 
     23 function testHook(hookName) {
     24  for (var h of handlers) {
     25    assertThrowsInstanceOf(h, Debugger.DebuggeeWouldRun);
     26  }
     27 }
     28 
     29 testDebuggerHooksNX(dbg, g, testHook);