michael@0: // Setting onStep does not affect later calls to the same function. michael@0: // (onStep is per-frame, not per-function.) michael@0: michael@0: var g = newGlobal(); michael@0: g.a = 1; michael@0: g.eval("function f(a) {\n" + michael@0: " var x = 2 * a;\n" + michael@0: " return x * x;\n" + michael@0: "}\n"); michael@0: michael@0: var dbg = Debugger(g); michael@0: var log = ''; michael@0: dbg.onEnterFrame = function (frame) { michael@0: log += '+'; michael@0: frame.onStep = function () { michael@0: if (log.charAt(log.length - 1) != 's') michael@0: log += 's'; michael@0: }; michael@0: }; michael@0: michael@0: g.f(1); michael@0: log += '|'; michael@0: g.f(2); michael@0: log += '|'; michael@0: dbg.onEnterFrame = undefined; michael@0: g.f(3); michael@0: michael@0: assertEq(log, '+s|+s|');