tor-browser

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

Debugger-debuggees-26.js (826B)


      1 // Ion can bail in-place when throwing exceptions with debug mode toggled on.
      2 
      3 load(libdir + "jitopts.js");
      4 
      5 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
      6  quit();
      7 
      8 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
      9  var g = newGlobal({newCompartment: true});
     10  var dbg = new Debugger;
     11 
     12  g.toggle = function toggle(x, d) {
     13    if (d) {
     14      dbg.addDebuggee(g);
     15      var frame = dbg.getNewestFrame().older;
     16      assertEq(frame.callee.name, "f");
     17      assertEq(frame.implementation, "ion");
     18      throw 42;
     19    }
     20  };
     21 
     22  g.eval("" + function f(x, d) { g(x, d); });
     23  g.eval("" + function g(x, d) { toggle(x, d); });
     24 
     25  try {
     26    g.eval("(" + function test() {
     27      for (var i = 0; i < 5; i++)
     28        f(42, false);
     29      f(42, true);
     30    } + ")();");
     31  } catch (exc) {
     32    assertEq(exc, 42);
     33  }
     34 });