tor-browser

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

Frame-onStep-09.js (634B)


      1 // After an implicit toString call throws an exception, the calling frame's
      2 // onStep hook fires.
      3 
      4 var g = newGlobal({newCompartment: true});
      5 g.eval("var x = {toString: function () { debugger; log += 'x'; throw 'mud'; }};");
      6 
      7 var dbg = Debugger(g);
      8 dbg.onDebuggerStatement = function (frame) {
      9    g.log += 'd';
     10    frame.older.onStep = function () {
     11        if (!g.log.match(/[sy]$/))
     12            g.log += 's';
     13    };
     14 };
     15 
     16 g.log = '';
     17 g.eval("try { x + ''; } catch (x) { }\n" +
     18       "log += 'y';\n");
     19 assertEq(g.log, "dxsy");
     20 
     21 g.log = '';
     22 g.eval("try { '' + x; } catch (x) { }\n" +
     23       "log += 'y';\n");
     24 assertEq(g.log, "dxsy");