1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Frame-onPop-throw-throw.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +// |jit-test| error: TestComplete 1.5 +// onPop can change a throw into a throw of a different value. 1.6 + 1.7 +load(libdir + "asserts.js"); 1.8 +var g = newGlobal(); 1.9 +var dbg = new Debugger(g); 1.10 + 1.11 +function test(type, provocation) { 1.12 + var log; 1.13 + 1.14 + // Help people figure out which 'test' call failed. 1.15 + print("type: " + uneval(type)); 1.16 + print("provocation: " + uneval(provocation)); 1.17 + 1.18 + dbg.onDebuggerStatement = function handleDebuggerStatement(f) { 1.19 + log += 'd'; 1.20 + }; 1.21 + 1.22 + dbg.onEnterFrame = function handleEnterFrame(f) { 1.23 + log += '('; 1.24 + assertEq(f.type, type); 1.25 + f.onPop = function handlePop(c) { 1.26 + log += ')'; 1.27 + assertEq(c.throw, 'mud'); 1.28 + return { throw: 'snow' }; 1.29 + }; 1.30 + }; 1.31 + 1.32 + log = ''; 1.33 + assertThrowsValue(provocation, 'snow'); 1.34 + assertEq(log, "(d)"); 1.35 + 1.36 + print(); 1.37 +} 1.38 + 1.39 +g.eval("function f() { debugger; throw 'mud'; }"); 1.40 +test("call", g.f); 1.41 +test("call", function () { return new g.f; }); 1.42 +test("eval", function () { return g.eval("debugger; throw \'mud\';"); }); 1.43 +test("global", function () { return g.evaluate("debugger; throw \'mud\';"); }); 1.44 +throw 'TestComplete';