michael@0: // frame.onStep can coexist with breakpoints. michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = Debugger(g); michael@0: var log = ''; michael@0: dbg.onEnterFrame = function (frame) { michael@0: var handler = {hit: function () { log += 'B'; }}; michael@0: var lines = frame.script.getAllOffsets(); michael@0: for (var line in lines) { michael@0: line = Number(line); michael@0: var offs = lines[line]; michael@0: for (var i = 0; i < offs.length; i++) michael@0: frame.script.setBreakpoint(offs[i], handler); michael@0: } michael@0: michael@0: frame.onStep = function () { log += 's'; }; michael@0: }; michael@0: michael@0: g.eval("one = 1;\n" + michael@0: "two = 2;\n" + michael@0: "three = 3;\n" + michael@0: "four = 4;\n"); michael@0: assertEq(g.four, 4); michael@0: michael@0: // Breakpoints hit on all four lines. michael@0: assertEq(log.replace(/[^B]/g, ''), 'BBBB'); michael@0: michael@0: // onStep was called between each pair of breakpoints. michael@0: assertEq(/BB/.exec(log), null);