tor-browser

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

Object-executeInGlobal-02.js (1047B)


      1 // Debugger.Object.prototype.executeInGlobal argument validation
      2 
      3 load(libdir + 'asserts.js');
      4 
      5 var g = newGlobal({newCompartment: true});
      6 var dbg = new Debugger();
      7 var gw = dbg.addDebuggee(g);
      8 var gobj = gw.makeDebuggeeValue(g.eval("({})"));
      9 
     10 assertThrowsInstanceOf(function () { gw.executeInGlobal(); }, TypeError);
     11 assertThrowsInstanceOf(function () { gw.executeInGlobal(10); }, TypeError);
     12 assertThrowsInstanceOf(function () { gobj.executeInGlobal('42'); }, TypeError);
     13 assertEq(gw.executeInGlobal('42').return, 42);
     14 
     15 assertThrowsInstanceOf(function () { gw.executeInGlobalWithBindings(); }, TypeError);
     16 assertThrowsInstanceOf(function () { gw.executeInGlobalWithBindings('42'); }, TypeError);
     17 assertThrowsInstanceOf(function () { gw.executeInGlobalWithBindings(10, 1729); }, TypeError);
     18 assertThrowsInstanceOf(function () { gw.executeInGlobalWithBindings('42', 1729); }, TypeError);
     19 assertThrowsInstanceOf(function () { gobj.executeInGlobalWithBindings('42', {}); }, TypeError);
     20 assertEq(gw.executeInGlobalWithBindings('42', {}).return, 42);