michael@0: // A frame's onPop handler is called only once, even if it is for a function michael@0: // called from a loop. michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger(g); michael@0: var log; michael@0: michael@0: var count; michael@0: dbg.onDebuggerStatement = function handleDebug(frame) { michael@0: log += 'd'; michael@0: assertEq(frame.type, "call"); michael@0: count++; michael@0: if (count == 10) { michael@0: frame.onPop = function handlePop(c) { michael@0: log += ')' + this.arguments[0]; michael@0: assertEq(c.return, "snifter"); michael@0: }; michael@0: } michael@0: }; michael@0: michael@0: g.eval("function f(n) { debugger; return 'snifter'; }"); michael@0: log = ''; michael@0: count = 0; michael@0: g.eval("for (i = 0; i < 20; i++) f(i);"); michael@0: assertEq(count, 20); michael@0: assertEq(log, "dddddddddd)9dddddddddd");