blob: 631e9b0a298936a7e633894b5c043c3d6dcc7939 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// A breakpoint handler may clear itself.
var g = newGlobal({newCompartment: true});
var bphits = 0;
var handler = {hit: function (frame) { frame.script.clearBreakpoint(this); bphits++; }};
var dbg = Debugger(g);
var hits = 0;
dbg.onDebuggerStatement = function (frame) {
var offs = frame.script.getLineOffsets(g.line0 + 3);
for (var i = 0; i < offs.length; i++)
frame.script.setBreakpoint(offs[i], handler);
hits++;
};
g.eval("var line0 = Error().lineNumber;\n" +
"debugger;\n" + // line0 + 1
"for (var i = 0; i < 4; i++)\n" + // line0 + 2
" result = 'ok';\n"); // line0 + 3
assertEq(hits, 1);
assertEq(bphits, 1);
|