tor-browser

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

Frame-onStep-resumption-04.js (915B)


      1 // If frame.onStep returns null, debuggee catch and finally blocks are skipped.
      2 
      3 var g = newGlobal({newCompartment: true});
      4 g.eval("function h() { debugger; }");
      5 
      6 var dbg = Debugger(g);
      7 var hits = 0;
      8 dbg.onDebuggerStatement = function (frame) {
      9    hits++;
     10    if (hits == 1) {
     11        var rv = frame.eval("try {\n" +
     12                            "    h();\n" +
     13                            "    throw 'fail';\n" +
     14                            "} catch (exc) {\n" +
     15                            "    caught = exc;\n" +
     16                            "} finally {\n" +
     17                            "    finallyHit = true;\n" +
     18                            "}\n");
     19        assertEq(rv, null);
     20    } else {
     21        frame.older.onStep = function () {
     22            this.onStep = undefined;
     23            return null;
     24        };
     25    }
     26 };
     27 
     28 g.h();
     29 assertEq(hits, 2);
     30 assertEq("caught" in g, false);
     31 assertEq("finallyHit" in g, false);