|
1 // When an exception is propagated out of multiple frames, their onPop |
|
2 // and onExceptionUnwind handlers are called in the correct order. |
|
3 var g = newGlobal(); |
|
4 g.eval("function f() { throw 'mud'; }"); |
|
5 g.eval("function g() { f(); }"); |
|
6 g.eval("function h() { g(); }"); |
|
7 g.eval("function i() { h(); }"); |
|
8 |
|
9 var dbg = new Debugger(g); |
|
10 var log; |
|
11 function makePopHandler(label) { |
|
12 return function handlePop(completion) { |
|
13 log += label; |
|
14 assertEq(completion.throw, "mud"); |
|
15 }; |
|
16 } |
|
17 dbg.onEnterFrame = function handleEnter(f) { |
|
18 log += "(" + f.callee.name; |
|
19 f.onPop = makePopHandler(")" + f.callee.name); |
|
20 }; |
|
21 dbg.onExceptionUnwind = function handleExceptionUnwind(f, x) { |
|
22 assertEq(x, 'mud'); |
|
23 log += "u" + f.callee.name; |
|
24 }; |
|
25 log = ''; |
|
26 try { |
|
27 g.i(); |
|
28 } catch (x) { |
|
29 log += 'c'; |
|
30 assertEq(x, "mud"); |
|
31 } |
|
32 assertEq(log, "(i(h(g(fuf)fug)guh)hui)ic"); |