tor-browser

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

Frame-onPop-throw.js (1115B)


      1 // |jit-test| error: TestComplete
      2 // onPop fires when frames throw an exception.
      3 
      4 load(libdir + "asserts.js");
      5 var g = newGlobal({newCompartment: true});
      6 var dbg = new Debugger(g);
      7 
      8 function test(type, provocation) {
      9    var log;
     10 
     11    // Help people figure out which 'test' call failed.
     12    print("type:        " + JSON.stringify(type));
     13    print("provocation: " + JSON.stringify(provocation));
     14 
     15    dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
     16        log += 'd';
     17    };
     18 
     19    dbg.onEnterFrame = function handleEnterFrame(f) {
     20        log += '(';
     21        assertEq(f.type, type);
     22        f.onPop = function handlePop(c) {
     23            log += ')';
     24            assertEq(c.throw, 'mud');
     25        };
     26    };
     27 
     28    log = '';
     29    assertThrowsValue(provocation, 'mud');
     30    assertEq(log, "(d)");
     31 
     32    print();
     33 }
     34 
     35 g.eval("function f() { debugger; throw 'mud'; }");
     36 test("call", g.f);
     37 test("call", function () { return new g.f; });
     38 test("eval", function () { return g.eval("debugger; throw \'mud\';"); });
     39 test("global", function () { return g.evaluate("debugger; throw \'mud\';"); });
     40 throw 'TestComplete';