tor-browser

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

Source-introductionScript-03.js (958B)


      1 // We don't record introduction scripts in a different global from the
      2 // introduced script, even if they're both debuggees.
      3 
      4 var dbg = new Debugger;
      5 
      6 var g1 = newGlobal({newCompartment: true});
      7 g1.g1 = g1;
      8 var g1DO = dbg.addDebuggee(g1);
      9 
     10 var g2 = newGlobal({newCompartment: true});
     11 g2.g1 = g1;
     12 
     13 var log = '';
     14 dbg.onDebuggerStatement = function (frame) {
     15  log += 'd';
     16  assertEq(frame.script.source.introductionScript, undefined);
     17  assertEq(frame.script.source.introductionOffset, undefined);
     18 };
     19 
     20 g2.eval('g1.eval("debugger;");');
     21 assertEq(log, 'd');
     22 
     23 // Just for sanity: when it's not cross-global, we do note the introducer.
     24 log = '';
     25 dbg.onDebuggerStatement = function (frame) {
     26  log += 'd';
     27  assertEq(frame.script.source.introductionScript instanceof Debugger.Script, true);
     28  assertEq(typeof frame.script.source.introductionOffset, "number");
     29 };
     30 // Exactly as above, but with g1 instead of g2.
     31 g1.eval('g1.eval("debugger;");');
     32 assertEq(log, 'd');