|
1 // When multiple frames have onPop handlers, they are called in the correct order. |
|
2 var g = newGlobal(); |
|
3 g.eval("function f() { debugger; }"); |
|
4 g.eval("function g() { f(); }"); |
|
5 g.eval("function h() { g(); }"); |
|
6 g.eval("function i() { h(); }"); |
|
7 |
|
8 var dbg = new Debugger(g); |
|
9 var log; |
|
10 function logger(frame, mark) { |
|
11 return function (completion) { |
|
12 assertEq(this, frame); |
|
13 assertEq('return' in completion, true); |
|
14 log += mark; |
|
15 }; |
|
16 } |
|
17 dbg.onEnterFrame = function handleEnter(f) { |
|
18 log += "(" + f.callee.name; |
|
19 // Note that this establishes a distinct function object as each |
|
20 // frame's onPop handler. Thus, a pass proves that each frame is |
|
21 // remembering its handler separately. |
|
22 f.onPop = logger(f, f.callee.name + ")"); |
|
23 }; |
|
24 dbg.onDebuggerStatement = function handleDebugger(f) { |
|
25 log += 'd'; |
|
26 }; |
|
27 log = ''; |
|
28 g.i(); |
|
29 assertEq(log, "(i(h(g(fdf)g)h)i)"); |