tor-browser

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

Debugger-findScripts-04.js (853B)


      1 // Within a series of evals and calls, all their frames' scripts appear in findScripts' result.
      2 var g = newGlobal({newCompartment: true});
      3 var dbg = new Debugger(g);
      4 var log;
      5 
      6 g.check = function () {
      7    log += 'c';
      8    var scripts = dbg.findScripts();
      9 
     10    var innerEvalFrame = dbg.getNewestFrame();
     11    assertEq(innerEvalFrame.type, "eval");
     12    assertEq(scripts.indexOf(innerEvalFrame.script) != -1, true);
     13 
     14    var callFrame = innerEvalFrame.older;
     15    assertEq(callFrame.type, "call");
     16    assertEq(scripts.indexOf(callFrame.script) != -1, true);
     17 
     18    var outerEvalFrame = callFrame.older;
     19    assertEq(outerEvalFrame.type, "eval");
     20    assertEq(scripts.indexOf(outerEvalFrame.script) != -1, true);
     21    assertEq(innerEvalFrame != outerEvalFrame, true);
     22 };
     23 
     24 g.eval('function f() { eval("check();") }');
     25 log = '';
     26 g.eval('f();');
     27 assertEq(log, 'c');