Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Ion can bail in-place when throwing exceptions with debug mode toggled on. |
michael@0 | 2 | |
michael@0 | 3 | load(libdir + "jitopts.js"); |
michael@0 | 4 | |
michael@0 | 5 | if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation)) |
michael@0 | 6 | quit(); |
michael@0 | 7 | |
michael@0 | 8 | withJitOptions(Opts_Ion2NoParallelCompilation, function () { |
michael@0 | 9 | var g = newGlobal(); |
michael@0 | 10 | var dbg = new Debugger; |
michael@0 | 11 | |
michael@0 | 12 | g.toggle = function toggle(x, d) { |
michael@0 | 13 | if (d) { |
michael@0 | 14 | dbg.addDebuggee(g); |
michael@0 | 15 | var frame = dbg.getNewestFrame().older; |
michael@0 | 16 | assertEq(frame.callee.name, "f"); |
michael@0 | 17 | assertEq(frame.implementation, "ion"); |
michael@0 | 18 | throw 42; |
michael@0 | 19 | } |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | g.eval("" + function f(x, d) { g(x, d); }); |
michael@0 | 23 | g.eval("" + function g(x, d) { toggle(x, d); }); |
michael@0 | 24 | |
michael@0 | 25 | try { |
michael@0 | 26 | g.eval("(" + function test() { |
michael@0 | 27 | for (var i = 0; i < 5; i++) |
michael@0 | 28 | f(42, false); |
michael@0 | 29 | f(42, true); |
michael@0 | 30 | } + ")();"); |
michael@0 | 31 | } catch (exc) { |
michael@0 | 32 | assertEq(exc, 42); |
michael@0 | 33 | } |
michael@0 | 34 | }); |