tor-browser

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

execution-observability-01.js (657B)


      1 // For perf reasons we don't recompile all a debuggee global's scripts when
      2 // Debugger no longer needs to observe all execution for that global. Test that
      3 // things don't crash if we try to run a script with a BaselineScript that was
      4 // compiled with debug instrumentation when the global is no longer a debuggee.
      5 
      6 var g = newGlobal({newCompartment: true});
      7 var dbg = new Debugger(g);
      8 var counter = 0;
      9 dbg.onDebuggerStatement = function (frame) {
     10  counter++;
     11  if (counter == 15)
     12    dbg.onDebuggerStatement = undefined;
     13 };
     14 
     15 g.eval("" + function f() {
     16  {
     17    let inner = 42;
     18    debugger;
     19    inner++;
     20  }
     21 });
     22 g.eval("for (var i = 0; i < 20; i++) f()");