tor-browser

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

Frame-onStep-10.js (692B)


      1 // Throwing and catching an error in an onStep handler shouldn't interfere
      2 // with throwing and catching in the debuggee.
      3 
      4 var g = newGlobal({newCompartment: true});
      5 g.eval("function f() { debugger; throw 'mud'; }");
      6 
      7 var dbg = Debugger(g);
      8 var stepped = false;
      9 dbg.onDebuggerStatement = function (frame) {
     10    frame.older.onStep = function () {
     11        stepped = true;
     12        try {
     13            throw 'snow';
     14        } catch (x) {
     15            assertEq(x, 'snow');
     16        }
     17    };
     18 };
     19 
     20 stepped = false;
     21 g.eval("var caught;\n" +
     22       "try {\n" +
     23       "    f();\n" +
     24       "} catch (x) {\n" +
     25       "    caught = x;\n" +
     26       "}\n");
     27 assertEq(stepped, true);
     28 assertEq(g.caught, 'mud');