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 | // After clearing one breakpoint, another breakpoint at the same instruction still works. |
michael@0 | 2 | |
michael@0 | 3 | var g = newGlobal(); |
michael@0 | 4 | var dbg = Debugger(g); |
michael@0 | 5 | var script = null; |
michael@0 | 6 | var handlers = []; |
michael@0 | 7 | dbg.onDebuggerStatement = function (frame) { |
michael@0 | 8 | function handler(i) { |
michael@0 | 9 | return {hit: function (frame) { g.log += '' + i; }}; |
michael@0 | 10 | } |
michael@0 | 11 | var f = frame.eval("f").return; |
michael@0 | 12 | var s = f.script; |
michael@0 | 13 | if (script === null) |
michael@0 | 14 | script = s; |
michael@0 | 15 | else |
michael@0 | 16 | assertEq(s, script); |
michael@0 | 17 | |
michael@0 | 18 | var offs = s.getLineOffsets(g.line0 + 3); |
michael@0 | 19 | for (var i = 0; i < 3; i++) { |
michael@0 | 20 | handlers[i] = handler(i); |
michael@0 | 21 | for (var j = 0; j < offs.length; j++) |
michael@0 | 22 | s.setBreakpoint(offs[j], handlers[i]); |
michael@0 | 23 | } |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | g.eval("var line0 = Error().lineNumber;\n" + |
michael@0 | 27 | "function f() {\n" + // line0 + 1 |
michael@0 | 28 | " log += 'x';\n" + // line0 + 2 |
michael@0 | 29 | " log += 'y';\n" + // line0 + 3 |
michael@0 | 30 | "}\n" + |
michael@0 | 31 | "debugger;\n"); |
michael@0 | 32 | assertEq(handlers.length, 3); |
michael@0 | 33 | |
michael@0 | 34 | g.log = ''; |
michael@0 | 35 | g.f(); |
michael@0 | 36 | assertEq(g.log, 'x012y'); |
michael@0 | 37 | |
michael@0 | 38 | script.clearBreakpoint(handlers[0]); |
michael@0 | 39 | |
michael@0 | 40 | g.log = ''; |
michael@0 | 41 | g.f(); |
michael@0 | 42 | assertEq(g.log, 'x12y'); |