tor-browser

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

Debugger-debuggees-06.js (757B)


      1 // {has,add,remove}Debuggee throw a TypeError if the argument is invalid.
      2 
      3 load(libdir + "asserts.js");
      4 
      5 var dbg = new Debugger;
      6 
      7 function check(val) {
      8    assertThrowsInstanceOf(function () { dbg.hasDebuggee(val); }, TypeError);
      9    assertThrowsInstanceOf(function () { dbg.addDebuggee(val); }, TypeError);
     10    assertThrowsInstanceOf(function () { dbg.removeDebuggee(val); }, TypeError);
     11 }
     12 
     13 // Primitive values are invalid.
     14 check(undefined);
     15 check(null);
     16 check(false);
     17 check(1);
     18 check(NaN);
     19 check("ok");
     20 check(Symbol("ok"));
     21 
     22 // A Debugger.Object that belongs to a different Debugger object is invalid.
     23 var g = newGlobal({newCompartment: true});
     24 var dbg2 = new Debugger;
     25 var w = dbg2.addDebuggee(g);
     26 assertEq(w instanceof Debugger.Object, true);
     27 check(w);