michael@0: // When multiple frames have onPop handlers, they are called in the correct order. michael@0: var g = newGlobal(); michael@0: g.eval("function f() { debugger; }"); michael@0: g.eval("function g() { f(); }"); michael@0: g.eval("function h() { g(); }"); michael@0: g.eval("function i() { h(); }"); michael@0: michael@0: var dbg = new Debugger(g); michael@0: var log; michael@0: function logger(frame, mark) { michael@0: return function (completion) { michael@0: assertEq(this, frame); michael@0: assertEq('return' in completion, true); michael@0: log += mark; michael@0: }; michael@0: } michael@0: dbg.onEnterFrame = function handleEnter(f) { michael@0: log += "(" + f.callee.name; michael@0: // Note that this establishes a distinct function object as each michael@0: // frame's onPop handler. Thus, a pass proves that each frame is michael@0: // remembering its handler separately. michael@0: f.onPop = logger(f, f.callee.name + ")"); michael@0: }; michael@0: dbg.onDebuggerStatement = function handleDebugger(f) { michael@0: log += 'd'; michael@0: }; michael@0: log = ''; michael@0: g.i(); michael@0: assertEq(log, "(i(h(g(fdf)g)h)i)");