tor-browser

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

Debugger-debuggees-11.js (826B)


      1 // Don't allow cycles in the graph of the compartment "debugs" relation.
      2 
      3 load(libdir + "asserts.js");
      4 
      5 // trivial cycles
      6 var dbg = new Debugger;
      7 assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError);
      8 assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
      9 
     10 // cycles of length 2
     11 var d1 = newGlobal({newCompartment: true});
     12 d1.top = this;
     13 d1.eval("var dbg = new Debugger(top)");
     14 assertThrowsInstanceOf(function () { dbg.addDebuggee(d1); }, TypeError);
     15 assertThrowsInstanceOf(function () { new Debugger(d1); }, TypeError);
     16 
     17 // cycles of length 3
     18 var d2 = newGlobal({newCompartment: true});
     19 d2.top = this;
     20 d2.eval("var dbg = new Debugger(top.d1)");
     21 assertThrowsInstanceOf(function () { dbg.addDebuggee(d2); }, TypeError);
     22 assertThrowsInstanceOf(function () { new Debugger(d2); }, TypeError);