// Test that we advance to the next line when a location // has both a breakpoint and set watchpoint.
async function testBreakpointAndSetWatchpoint({
commands,
threadFront,
debuggee,
}) {
async function evaluateJS(input) { const { result } = await commands.scriptCommand.execute(input, {
frameActor: packet.frame.actorID,
}); return result;
}
info("Test that we pause on the second debugger statement."); Assert.equal(packet3.frame.where.line, 5); Assert.equal(packet3.why.type, "debuggerStatement");
info("Test that the value has updated."); const result = await evaluateJS("obj.a"); Assert.equal(result, 2);
info("Remove breakpoint and finish.");
threadFront.removeBreakpoint(location, {});
await resume(threadFront);
}
// Test that we advance to the next line when a location // has both a breakpoint and get watchpoint.
async function testBreakpointAndGetWatchpoint({ threadFront, debuggee }) { function evaluateTestCode(debuggee) { /* eslint-disable */
Cu.evalInSandbox(
` // 1 function stopMe(obj) { // 2
debugger; // 3
obj.a + 4; // 4
debugger; // 5
} //
stopMe({a: 1})`,
debuggee, "1.8", "test_watchpoint-02.js"
); /* eslint-disable */
}
info("Test that we pause on the second debugger statement."); Assert.equal(packet3.frame.where.line, 5); Assert.equal(packet3.why.type, "debuggerStatement");
info("Remove breakpoint and finish.");
threadFront.removeBreakpoint(location, {});
await resume(threadFront);
}
// Test that we can pause multiple times // on the same line for a watchpoint.
async function testLoops({ commands, threadFront, debuggee }) {
async function evaluateJS(input) { const { result } = await commands.scriptCommand.execute(input, {
frameActor: packet.frame.actorID,
}); return result;
}
info("Test that watchpoint triggers pause on set."); const packet2 = await resumeAndWaitForPause(threadFront); Assert.equal(packet2.frame.where.line, 6); Assert.equal(packet2.why.type, "setWatchpoint");
let result = await evaluateJS("obj.a"); Assert.equal(result, 1);
info("Test that watchpoint triggers pause on set (2nd time)."); const packet3 = await resumeAndWaitForPause(threadFront); Assert.equal(packet3.frame.where.line, 6); Assert.equal(packet3.why.type, "setWatchpoint");
let result2 = await evaluateJS("obj.a"); Assert.equal(result2, 2);
info("Test that we pause on second debugger statement."); const packet4 = await resumeAndWaitForPause(threadFront); Assert.equal(packet4.frame.where.line, 8); Assert.equal(packet4.why.type, "debuggerStatement");
await resume(threadFront);
}
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.