tor-browser

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

Frame-eval-21.js (760B)


      1 // Eval-in-frame with different type on baseline frame with let-scoping
      2 
      3 load(libdir + "jitopts.js");
      4 
      5 if (!jitTogglesMatch(Opts_BaselineEager))
      6  quit(0);
      7 
      8 withJitOptions(Opts_BaselineEager, function () {
      9  var g = newGlobal({newCompartment: true});
     10  var dbg = new Debugger;
     11 
     12  g.h = function h(d) {
     13    if (d) {
     14      dbg.addDebuggee(g);
     15      var f = dbg.getNewestFrame().older;
     16      assertEq(f.implementation, "baseline");
     17      assertEq(f.environment.getVariable("foo"), 42);
     18      f.eval("foo = 'string of 42'");
     19    }
     20  }
     21 
     22  g.eval("" + function f(d) {
     23    if (d) {
     24      let foo = 42;
     25      g(d);
     26      return foo;
     27    }
     28  });
     29 
     30  g.eval("" + function g(d) { h(d); });
     31 
     32  g.eval("(" + function () { assertEq(f(true), "string of 42"); } + ")();");
     33 });