tor-browser

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

Debugger-onNewGlobalObject-08.js (631B)


      1 // Creating a global within an onNewGlobalObject handler causes a recursive handler invocation.
      2 //
      3 // This isn't really desirable behavior, as presumably a global created while a
      4 // handler is running is one the debugger is creating for its own purposes and
      5 // should not be observed, but if this behavior changes, we sure want to know.
      6 
      7 var dbg = new Debugger;
      8 var log;
      9 var depth;
     10 
     11 dbg.onNewGlobalObject = function (global) {
     12  log += '('; depth++;
     13 
     14  assertEq(global.seen, undefined);
     15  global.seen = true;
     16 
     17  if (depth < 3)
     18    newGlobal();
     19 
     20  log += ')'; depth--;
     21 };
     22 
     23 log = '';
     24 depth = 0;
     25 newGlobal();
     26 assertEq(log, '((()))');