|
1 // When a termination is propagated out of multiple frames, their onPop |
|
2 // handlers are called in the correct order, and no onExceptionUnwind |
|
3 // handlers are called. |
|
4 var g = newGlobal(); |
|
5 g.eval("function f() { terminate(); }"); |
|
6 g.eval("function g() { f(); }"); |
|
7 g.eval("function h() { g(); }"); |
|
8 g.eval("function i() { h(); }"); |
|
9 |
|
10 var dbg = new Debugger(g); |
|
11 var log; |
|
12 var count = 0; |
|
13 function makePopHandler(label, resumption) { |
|
14 return function handlePop(completion) { |
|
15 log += label; |
|
16 assertEq(completion, null); |
|
17 return resumption; |
|
18 }; |
|
19 } |
|
20 dbg.onEnterFrame = function handleEnter(f) { |
|
21 log += "(" + f.callee.name; |
|
22 f.onPop = makePopHandler(f.callee.name + ")", |
|
23 count++ == 0 ? { return: 'king' } : undefined); |
|
24 }; |
|
25 dbg.onExceptionUnwind = function handleExceptionUnwind(f, x) { |
|
26 log += 'u'; |
|
27 }; |
|
28 log = ''; |
|
29 assertEq(g.i(), 'king'); |
|
30 assertEq(log, "(i(h(g(ff)g)h)i)"); |