michael@0: // reentering the debugger several times via onDebuggerStatement and apply/call on a single stack michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = Debugger(g); michael@0: michael@0: function test(usingApply) { michael@0: dbg.onDebuggerStatement = function (frame) { michael@0: var n = frame.arguments[0]; michael@0: if (n > 1) { michael@0: var result = usingApply ? frame.callee.apply(null, [n - 1]) michael@0: : frame.callee.call(null, n - 1); michael@0: result.return *= n; michael@0: return result; michael@0: } michael@0: }; michael@0: g.eval("function fac(n) { debugger; return 1; }"); michael@0: assertEq(g.fac(5), 5 * 4 * 3 * 2 * 1); michael@0: } michael@0: michael@0: test(true); michael@0: test(false);