Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 // |jit-test| error: TestComplete
2 // onPop can change a throw into a throw of a different value.
4 load(libdir + "asserts.js");
5 var g = newGlobal();
6 var dbg = new Debugger(g);
8 function test(type, provocation) {
9 var log;
11 // Help people figure out which 'test' call failed.
12 print("type: " + uneval(type));
13 print("provocation: " + uneval(provocation));
15 dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
16 log += 'd';
17 };
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 };
29 log = '';
30 assertThrowsValue(provocation, 'snow');
31 assertEq(log, "(d)");
33 print();
34 }
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';