tor-browser

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

bug-1640034-dbg-eval-across-compartments.js (794B)


      1 // This test ensures that capturing a stack works when the Debugger.Frame
      2 // being used for an eval has an async stack on the activation between
      3 // the two debuggee frames.
      4 
      5 const global = newGlobal({ newCompartment: true });
      6 const dbg = new Debugger(global);
      7 dbg.onDebuggerStatement = function() {
      8  const frame = dbg.getNewestFrame();
      9 
     10  // Capturing this stack inside the debugger compartment will populate the
     11  // LiveSavedFrameCache with a SavedFrame in the debugger compartment.
     12  const opts = {
     13    stack: saveStack(),
     14  };
     15 
     16  bindToAsyncStack(function() {
     17    // This captured stack needs to properly invalidate the LiveSavedFrameCache
     18    // for the frame and create a new one inside the debuggee compartment.
     19    frame.eval(`saveStack()`);
     20  }, opts)();
     21 };
     22 global.eval(`debugger;`);