js/src/jit-test/tests/debug/Frame-onPop-throw-throw.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:900b7671efda
1 // |jit-test| error: TestComplete
2 // onPop can change a throw into a throw of a different value.
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 };
18
19 dbg.onEnterFrame = function handleEnterFrame(f) {
20 log += '(';
21 assertEq(f.type, type);
22 f.onPop = function handlePop(c) {
23 log += ')';
24 assertEq(c.throw, 'mud');
25 return { throw: 'snow' };
26 };
27 };
28
29 log = '';
30 assertThrowsValue(provocation, 'snow');
31 assertEq(log, "(d)");
32
33 print();
34 }
35
36 g.eval("function f() { debugger; throw 'mud'; }");
37 test("call", g.f);
38 test("call", function () { return new g.f; });
39 test("eval", function () { return g.eval("debugger; throw \'mud\';"); });
40 test("global", function () { return g.evaluate("debugger; throw \'mud\';"); });
41 throw 'TestComplete';

mercurial