michael@0: // |jit-test| error: TestComplete michael@0: // onPop fires when frames throw an exception. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger(g); michael@0: michael@0: function test(type, provocation) { michael@0: var log; michael@0: michael@0: // Help people figure out which 'test' call failed. michael@0: print("type: " + uneval(type)); michael@0: print("provocation: " + uneval(provocation)); michael@0: michael@0: dbg.onDebuggerStatement = function handleDebuggerStatement(f) { michael@0: log += 'd'; michael@0: }; michael@0: michael@0: dbg.onEnterFrame = function handleEnterFrame(f) { michael@0: log += '('; michael@0: assertEq(f.type, type); michael@0: f.onPop = function handlePop(c) { michael@0: log += ')'; michael@0: assertEq(c.throw, 'mud'); michael@0: }; michael@0: }; michael@0: michael@0: log = ''; michael@0: assertThrowsValue(provocation, 'mud'); michael@0: assertEq(log, "(d)"); michael@0: michael@0: print(); michael@0: } michael@0: michael@0: g.eval("function f() { debugger; throw 'mud'; }"); michael@0: test("call", g.f); michael@0: test("call", function () { return new g.f; }); michael@0: test("eval", function () { return g.eval("debugger; throw \'mud\';"); }); michael@0: test("global", function () { return g.evaluate("debugger; throw \'mud\';"); }); michael@0: throw 'TestComplete';