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 | // |jit-test| debug |
michael@0 | 2 | // Ensure the correct frame is passed to exception unwind hooks. |
michael@0 | 3 | var g = newGlobal(); |
michael@0 | 4 | g.debuggeeGlobal = this; |
michael@0 | 5 | g.eval("(" + function () { |
michael@0 | 6 | frames = []; |
michael@0 | 7 | var dbg = Debugger(debuggeeGlobal); |
michael@0 | 8 | dbg.onEnterFrame = function(frame) { |
michael@0 | 9 | frames.push(frame); |
michael@0 | 10 | }; |
michael@0 | 11 | dbg.onExceptionUnwind = function(frame) { |
michael@0 | 12 | assertEq(frames.indexOf(frame), frames.length - 1); |
michael@0 | 13 | frames.pop(); |
michael@0 | 14 | assertEq(frame, dbg.getNewestFrame()); |
michael@0 | 15 | } |
michael@0 | 16 | } + ")()"); |
michael@0 | 17 | |
michael@0 | 18 | function f(n) { |
michael@0 | 19 | debugger; |
michael@0 | 20 | n--; |
michael@0 | 21 | if (n > 0) { |
michael@0 | 22 | f(n); |
michael@0 | 23 | } else { |
michael@0 | 24 | assertEq(g.frames.length, 10); |
michael@0 | 25 | throw "fit"; |
michael@0 | 26 | } |
michael@0 | 27 | } |
michael@0 | 28 | try { |
michael@0 | 29 | f(10); |
michael@0 | 30 | assertEq(0, 1); |
michael@0 | 31 | } catch (e) { |
michael@0 | 32 | assertEq(e, "fit"); |
michael@0 | 33 | } |
michael@0 | 34 | assertEq(g.frames.length, 0); |