michael@0: // |jit-test| error: TestComplete michael@0: // onPop can request a termination when stopped for a termination michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger(g); michael@0: michael@0: // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we michael@0: // can catch the termination. michael@0: michael@0: function test(type, provocation) { 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: var log; michael@0: dbg.onEnterFrame = function handleFirstFrame(f) { michael@0: log += 'f'; michael@0: dbg.onDebuggerStatement = function handleDebugger(f) { michael@0: log += 'd'; michael@0: return null; michael@0: }; michael@0: michael@0: dbg.onEnterFrame = function handleSecondFrame(f) { michael@0: log += 'e'; michael@0: assertEq(f.type, 'eval'); michael@0: michael@0: dbg.onEnterFrame = function handleThirdFrame(f) { michael@0: log += '('; michael@0: assertEq(f.type, type); michael@0: michael@0: dbg.onEnterFrame = function handleExtraFrames(f) { michael@0: // This should never be called. michael@0: assertEq(false, true); michael@0: }; michael@0: michael@0: f.onPop = function handlePop(c) { michael@0: log += ')'; michael@0: assertEq(c, null); michael@0: return null; michael@0: }; michael@0: }; michael@0: }; michael@0: michael@0: assertEq(f.eval(provocation), null); michael@0: }; michael@0: michael@0: log = ''; michael@0: // This causes handleFirstFrame to be called. michael@0: assertEq(typeof g.eval('eval'), 'function'); michael@0: assertEq(log, 'fe(d)'); michael@0: michael@0: print(); michael@0: } michael@0: michael@0: g.eval('function f() { debugger; return \'termination fail\'; }'); michael@0: test('call', 'f();'); michael@0: test('call', 'new f;'); michael@0: test('eval', 'eval(\'debugger; \\\'termination fail\\\';\');'); michael@0: test('global', 'evaluate(\'debugger; \\\'termination fail\\\';\');'); michael@0: throw 'TestComplete';