|
1 // |jit-test| debug |
|
2 // Returning and throwing objects. |
|
3 |
|
4 load(libdir + "asserts.js"); |
|
5 |
|
6 var g = newGlobal(); |
|
7 g.debuggeeGlobal = this; |
|
8 g.eval("(" + function () { |
|
9 var how, what; |
|
10 var dbg = new Debugger(debuggeeGlobal); |
|
11 dbg.onDebuggerStatement = function (frame) { |
|
12 if (frame.callee.name === "configure") { |
|
13 how = frame.arguments[0]; |
|
14 what = frame.arguments[1]; |
|
15 } else { |
|
16 var resume = {}; |
|
17 resume[how] = what; |
|
18 return resume; |
|
19 } |
|
20 }; |
|
21 } + ")();"); |
|
22 |
|
23 function configure(how, what) { debugger; } |
|
24 function fire() { debugger; } |
|
25 |
|
26 var d = new Date; |
|
27 configure('return', d); |
|
28 assertEq(fire(), d); |
|
29 configure('return', Math); |
|
30 assertEq(fire(), Math); |
|
31 |
|
32 var x = new Error('oh no what are you doing'); |
|
33 configure('throw', x); |
|
34 assertThrowsValue(fire, x); |
|
35 configure('throw', parseInt); |
|
36 assertThrowsValue(fire, parseInt); |