Debug = debug.Debug
var exception = null;
function breakListener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
exec_state.prepareStep(Debug.StepAction.StepInto);
assertTrue(exec_state.frame(0).sourceLineText().indexOf("// break") > 0);
} catch (e) {
exception = e;
}
}
Debug.setListener(breakListener);
debugger;
function f(x) {
return x;
}
Debug.setBreakPoint(f, 0, 0);
new Error("123").stack;
Math.sin(0);
f("this should break");
Debug.setListener(null);
f("this should not break");
assertNull(exception);