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 | // Return resumption values to non-debuggee frames. |
michael@0 | 2 | |
michael@0 | 3 | load(libdir + 'asserts.js'); |
michael@0 | 4 | |
michael@0 | 5 | var g = newGlobal(); |
michael@0 | 6 | var dbg = new Debugger; |
michael@0 | 7 | |
michael@0 | 8 | var log; |
michael@0 | 9 | |
michael@0 | 10 | function handlerWithResumption(resumption) { |
michael@0 | 11 | return function (frame) { |
michael@0 | 12 | log += 'd'; |
michael@0 | 13 | dbg.removeDebuggee(g); |
michael@0 | 14 | return resumption; |
michael@0 | 15 | }; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | log = ''; |
michael@0 | 19 | dbg.onDebuggerStatement = handlerWithResumption(undefined); |
michael@0 | 20 | dbg.addDebuggee(g); |
michael@0 | 21 | assertEq(g.eval('debugger; 42;'), 42); |
michael@0 | 22 | assertEq(log, 'd'); |
michael@0 | 23 | |
michael@0 | 24 | log = ''; |
michael@0 | 25 | dbg.onDebuggerStatement = handlerWithResumption({ return: 1729 }); |
michael@0 | 26 | dbg.addDebuggee(g); |
michael@0 | 27 | assertEq(g.eval('debugger; 42;'), 1729); |
michael@0 | 28 | assertEq(log, 'd'); |
michael@0 | 29 | |
michael@0 | 30 | log = ''; |
michael@0 | 31 | dbg.onDebuggerStatement = handlerWithResumption(null); |
michael@0 | 32 | dbg.addDebuggee(g); |
michael@0 | 33 | assertEq(g.evaluate('debugger; 42;', { catchTermination: true }), 'terminated'); |
michael@0 | 34 | assertEq(log, 'd'); |