|
1 // |jit-test| error: TestComplete |
|
2 // onPop can change a termination into a throw. |
|
3 |
|
4 load(libdir + "asserts.js"); |
|
5 var g = newGlobal(); |
|
6 var dbg = new Debugger(g); |
|
7 |
|
8 function test(type, provocation) { |
|
9 var log; |
|
10 |
|
11 // Help people figure out which 'test' call failed. |
|
12 print("type: " + uneval(type)); |
|
13 print("provocation: " + uneval(provocation)); |
|
14 |
|
15 dbg.onDebuggerStatement = function handleDebuggerStatement(f) { |
|
16 log += 'd'; |
|
17 return null; |
|
18 }; |
|
19 |
|
20 dbg.onEnterFrame = function handleEnterFrame(f) { |
|
21 log += '('; |
|
22 assertEq(f.type, type); |
|
23 f.onPop = function handlePop(c) { |
|
24 log += ')'; |
|
25 assertEq(c, null); |
|
26 return { throw: 'snow' }; |
|
27 }; |
|
28 }; |
|
29 |
|
30 log = ''; |
|
31 assertThrowsValue(provocation, 'snow'); |
|
32 assertEq(log, "(d)"); |
|
33 |
|
34 print(); |
|
35 } |
|
36 |
|
37 g.eval("function f() { debugger; return 'termination fail'; }"); |
|
38 test("call", g.f); |
|
39 test("call", function () { return new g.f; }); |
|
40 test("eval", function () { return g.eval("debugger; \'termination fail\';"); }); |
|
41 test("global", function () { return g.evaluate("debugger; \'termination fail\';"); }); |
|
42 throw 'TestComplete'; |