зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576797 - Remove threadFront/target references from web replay tests, r=jlast.
Differential Revision: https://phabricator.services.mozilla.com/D43558 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1b831273d7
Коммит
3ecbce3546
|
@ -8,8 +8,7 @@ add_task(async function() {
|
|||
await waitForPaused(dbg);
|
||||
assertPausedLocation(dbg);
|
||||
|
||||
const target = dbg.toolbox.target;
|
||||
await checkEvaluateInTopFrame(target, 'window.scrollBy(0, 10);', undefined);
|
||||
await checkEvaluateInTopFrame(dbg, 'window.scrollBy(0, 10);', undefined);
|
||||
|
||||
// checkEvaluateInTopFrame does an implicit resume for some reason.
|
||||
await waitForPaused(dbg);
|
||||
|
|
|
@ -1739,9 +1739,9 @@ async function getDebuggerSplitConsole(dbg) {
|
|||
|
||||
// Return a promise that resolves with the result of a thread evaluating a
|
||||
// string in the topmost frame.
|
||||
async function evaluateInTopFrame(target, text) {
|
||||
const threadFront = target.threadFront;
|
||||
const consoleFront = await target.getFront("console");
|
||||
async function evaluateInTopFrame(dbg, text) {
|
||||
const threadFront = dbg.toolbox.target.threadFront;
|
||||
const consoleFront = await dbg.toolbox.target.getFront("console");
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
ok(frames.length == 1, "Got one frame");
|
||||
const options = { thread: threadFront.actor, frameActor: frames[0].actor };
|
||||
|
@ -1751,8 +1751,8 @@ async function evaluateInTopFrame(target, text) {
|
|||
|
||||
// Return a promise that resolves when a thread evaluates a string in the
|
||||
// topmost frame, ensuring the result matches the expected value.
|
||||
async function checkEvaluateInTopFrame(target, text, expected) {
|
||||
const rval = await evaluateInTopFrame(target, text);
|
||||
async function checkEvaluateInTopFrame(dbg, text, expected) {
|
||||
const rval = await evaluateInTopFrame(dbg, text);
|
||||
ok(rval == expected, `Eval returned ${expected}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,31 +9,29 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
|
||||
// Visit a lot of breakpoints so that we are sure we have crossed major
|
||||
// checkpoint boundaries.
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 8);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 7);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 6);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 7);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 8);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 9);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 8);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 7);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 6);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 7);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 8);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 9);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -9,17 +9,15 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await checkEvaluateInTopFrameThrows(target, "window.alert(3)");
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await checkEvaluateInTopFrameThrows(target, "window.alert(3)");
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await checkEvaluateInTopFrame(target, "testStepping2()", undefined);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await checkEvaluateInTopFrameThrows(dbg, "window.alert(3)");
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await checkEvaluateInTopFrameThrows(dbg, "window.alert(3)");
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await checkEvaluateInTopFrame(dbg, "testStepping2()", undefined);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -7,20 +7,15 @@
|
|||
// Test some issues when stepping around after hitting a breakpoint while recording.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");
|
||||
const { threadFront } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp1 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 19);
|
||||
await resumeToLine(threadFront, 19);
|
||||
await reverseStepOverToLine(threadFront, 18);
|
||||
await stepInToLine(threadFront, 22);
|
||||
const bp2 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 24);
|
||||
await resumeToLine(threadFront, 24);
|
||||
const bp3 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 22);
|
||||
await rewindToLine(threadFront, 22);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 19);
|
||||
await resumeToLine(dbg, 19);
|
||||
await reverseStepOverToLine(dbg, 18);
|
||||
await stepInToLine(dbg, 22);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 24);
|
||||
await resumeToLine(dbg, 24);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 22);
|
||||
await rewindToLine(dbg, 22);
|
||||
|
||||
await threadFront.removeBreakpoint(bp1);
|
||||
await threadFront.removeBreakpoint(bp2);
|
||||
await threadFront.removeBreakpoint(bp3);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -8,24 +8,22 @@
|
|||
// recording.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
const value = await evaluateInTopFrame(target, "number");
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 1);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 1);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 2);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 3);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 2);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(dbg, 14);
|
||||
const value = await evaluateInTopFrame(dbg, "number");
|
||||
await resumeToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 1);
|
||||
await rewindToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value);
|
||||
await resumeToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 1);
|
||||
await resumeToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 2);
|
||||
await resumeToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 3);
|
||||
await rewindToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 2);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -11,19 +11,14 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
|
||||
// Rewind to the beginning of the recording.
|
||||
await rewindToLine(threadFront, undefined);
|
||||
await rewindToLine(dbg, undefined);
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 1);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 2);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 1);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 2);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -10,8 +10,6 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_control_flow.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront } = dbg;
|
||||
const breakpoints = [];
|
||||
|
||||
await rewindToBreakpoint(10);
|
||||
await resumeToBreakpoint(12);
|
||||
|
@ -19,27 +17,22 @@ add_task(async function() {
|
|||
await resumeToBreakpoint(20);
|
||||
await resumeToBreakpoint(32);
|
||||
await resumeToBreakpoint(27);
|
||||
await resumeToLine(threadFront, 32);
|
||||
await resumeToLine(threadFront, 27);
|
||||
await resumeToLine(dbg, 32);
|
||||
await resumeToLine(dbg, 27);
|
||||
await resumeToBreakpoint(42);
|
||||
await resumeToBreakpoint(44);
|
||||
await resumeToBreakpoint(50);
|
||||
await resumeToBreakpoint(54);
|
||||
|
||||
for (const bp of breakpoints) {
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
}
|
||||
await shutdownDebugger(dbg);
|
||||
|
||||
async function rewindToBreakpoint(line) {
|
||||
const bp = await setBreakpoint(threadFront, "doc_control_flow.html", line);
|
||||
breakpoints.push(bp);
|
||||
await rewindToLine(threadFront, line);
|
||||
await addBreakpoint(dbg, "doc_control_flow.html", line);
|
||||
await rewindToLine(dbg, line);
|
||||
}
|
||||
|
||||
async function resumeToBreakpoint(line) {
|
||||
const bp = await setBreakpoint(threadFront, "doc_control_flow.html", line);
|
||||
breakpoints.push(bp);
|
||||
await resumeToLine(threadFront, line);
|
||||
await addBreakpoint(dbg, "doc_control_flow.html", line);
|
||||
await resumeToLine(dbg, line);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,23 +11,20 @@ PromiseTestUtils.whitelistRejectionsGlobally(/Unknown source actor/);
|
|||
|
||||
// Test interaction of breakpoints with debugger statements.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_debugger_statements.html");
|
||||
const { threadFront } = dbg;
|
||||
const dbg = await attachRecordingDebugger("doc_debugger_statements.html", {
|
||||
skipInterrupt: true,
|
||||
});
|
||||
|
||||
await waitForPaused(dbg);
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
ok(frames[0].where.line == 6, "Paused at first debugger statement");
|
||||
const pauseLine = getVisibleSelectedFrameLine(dbg);
|
||||
ok(pauseLine == 6, "Paused at first debugger statement");
|
||||
|
||||
const bp = await setBreakpoint(
|
||||
threadFront,
|
||||
"doc_debugger_statements.html",
|
||||
7
|
||||
);
|
||||
await resumeToLine(threadFront, 7);
|
||||
await resumeToLine(threadFront, 8);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await rewindToLine(threadFront, 6);
|
||||
await resumeToLine(threadFront, 8);
|
||||
await addBreakpoint(dbg, "doc_debugger_statements.html", 7);
|
||||
await resumeToLine(dbg, 7);
|
||||
await resumeToLine(dbg, 8);
|
||||
await dbg.actions.removeAllBreakpoints(getContext(dbg));
|
||||
await rewindToLine(dbg, 6);
|
||||
await resumeToLine(dbg, 8);
|
||||
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -10,25 +10,22 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { threadFront, target } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
await warpToMessage(hud, dbg, "Number 5");
|
||||
await threadFront.interrupt();
|
||||
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 5);
|
||||
|
||||
// Initially we are paused inside the 'new Error()' call on line 19. The
|
||||
// first reverse step takes us to the start of that line.
|
||||
await reverseStepOverToLine(threadFront, 19);
|
||||
await reverseStepOverToLine(threadFront, 18);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_error.html", 12);
|
||||
await rewindToLine(threadFront, 12);
|
||||
await checkEvaluateInTopFrame(target, "number", 4);
|
||||
await resumeToLine(threadFront, 12);
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
await reverseStepOverToLine(dbg, 19);
|
||||
await reverseStepOverToLine(dbg, 18);
|
||||
await addBreakpoint(dbg, "doc_rr_error.html", 12);
|
||||
await rewindToLine(dbg, 12);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 4);
|
||||
await resumeToLine(dbg, 12);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 5);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -10,15 +10,14 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { threadFront } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
let message = await warpToMessage(hud, dbg, "number: 1");
|
||||
// ok(message.classList.contains("paused-before"), "paused before message is shown");
|
||||
|
||||
await stepOverToLine(threadFront, 18);
|
||||
await reverseStepOverToLine(threadFront, 17);
|
||||
await stepOverToLine(dbg, 18);
|
||||
await reverseStepOverToLine(dbg, 17);
|
||||
|
||||
message = findMessage(hud, "number: 1");
|
||||
// ok(message.classList.contains("paused-before"), "paused before message is shown");
|
||||
|
|
|
@ -11,21 +11,27 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { threadFront, target } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
const bp1 = await setBreakpoint(threadFront, "doc_rr_basic.html", 21, {
|
||||
await selectSource(dbg, "doc_rr_basic.html");
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21, undefined, {
|
||||
logValue: `"Logpoint Number " + number`,
|
||||
});
|
||||
const bp2 = await setBreakpoint(threadFront, "doc_rr_basic.html", 6, {
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 6, undefined, {
|
||||
logValue: `"Logpoint Beginning"`,
|
||||
});
|
||||
const bp3 = await setBreakpoint(threadFront, "doc_rr_basic.html", 8, {
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 8, undefined, {
|
||||
logValue: `"Logpoint Ending"`,
|
||||
});
|
||||
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
const messages = await waitForMessageCount(hud, "Logpoint", 12);
|
||||
|
||||
ok(
|
||||
!findMessages(hud, "Loading"),
|
||||
"Loading messages should have been removed"
|
||||
);
|
||||
|
||||
ok(messages[0].textContent.includes("Beginning"));
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
ok(messages[i].textContent.includes("Number " + i));
|
||||
|
@ -33,13 +39,9 @@ add_task(async function() {
|
|||
ok(messages[11].textContent.includes("Ending"));
|
||||
|
||||
await warpToMessage(hud, dbg, "Number 5");
|
||||
await threadFront.interrupt();
|
||||
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
await reverseStepOverToLine(threadFront, 20);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 5);
|
||||
await reverseStepOverToLine(dbg, 20);
|
||||
|
||||
await threadFront.removeBreakpoint(bp1);
|
||||
await threadFront.removeBreakpoint(bp2);
|
||||
await threadFront.removeBreakpoint(bp3);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -36,7 +36,5 @@ add_task(async function() {
|
|||
});
|
||||
await waitForMessageCount(hud, "Logpoint", 6);
|
||||
|
||||
await dbg.actions.removeAllBreakpoints(getContext(dbg));
|
||||
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -26,18 +26,15 @@ add_task(async function() {
|
|||
await once(Services.ppmm, "HitRecordingEndpoint");
|
||||
|
||||
const dbg = await attachDebugger(replayingTab);
|
||||
const { threadFront } = dbg.toolbox;
|
||||
const { target } = dbg;
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 9);
|
||||
await resumeToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
|
||||
await gBrowser.removeTab(recordingTab);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -15,25 +15,20 @@ add_task(async function() {
|
|||
gBrowser.selectedTab = recordingTab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_continuous.html", "current");
|
||||
|
||||
const firstTab = await attachDebugger(recordingTab);
|
||||
let toolbox = firstTab.toolbox;
|
||||
let target = firstTab.target;
|
||||
let threadFront = toolbox.threadFront;
|
||||
await threadFront.interrupt();
|
||||
let bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await reverseStepOverToLine(threadFront, 13);
|
||||
const lastNumberValue = await evaluateInTopFrame(target, "number");
|
||||
let dbg = await attachDebugger(recordingTab);
|
||||
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(dbg, 14);
|
||||
await resumeToLine(dbg, 14);
|
||||
await reverseStepOverToLine(dbg, 13);
|
||||
const lastNumberValue = await evaluateInTopFrame(dbg, "number");
|
||||
|
||||
const remoteTab = recordingTab.linkedBrowser.frameLoader.remoteTab;
|
||||
ok(remoteTab, "Found recording remote tab");
|
||||
ok(remoteTab.saveRecording(recordingFile), "Saved recording");
|
||||
await once(Services.ppmm, "SaveRecordingFinished");
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(recordingTab);
|
||||
await shutdownDebugger(dbg);
|
||||
|
||||
const replayingTab = BrowserTestUtils.addTab(gBrowser, null, {
|
||||
replayExecution: recordingFile,
|
||||
|
@ -41,24 +36,19 @@ add_task(async function() {
|
|||
gBrowser.selectedTab = replayingTab;
|
||||
await once(Services.ppmm, "HitRecordingEndpoint");
|
||||
|
||||
const dbg = await attachDebugger(replayingTab);
|
||||
toolbox = dbg.toolbox;
|
||||
target = dbg.target;
|
||||
threadFront = toolbox.threadFront;
|
||||
await threadFront.interrupt();
|
||||
dbg = await attachDebugger(replayingTab);
|
||||
|
||||
// The recording does not actually end at the point where we saved it, but
|
||||
// will do at the next checkpoint. Rewind to the point we are interested in.
|
||||
bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 14);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 14);
|
||||
await rewindToLine(dbg, 14);
|
||||
|
||||
await checkEvaluateInTopFrame(target, "number", lastNumberValue);
|
||||
await reverseStepOverToLine(threadFront, 13);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", lastNumberValue - 1);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", lastNumberValue);
|
||||
await checkEvaluateInTopFrame(dbg, "number", lastNumberValue);
|
||||
await reverseStepOverToLine(dbg, 13);
|
||||
await rewindToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", lastNumberValue - 1);
|
||||
await resumeToLine(dbg, 14);
|
||||
await checkEvaluateInTopFrame(dbg, "number", lastNumberValue);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -9,18 +9,15 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await reverseStepOverToLine(threadFront, 20);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await checkEvaluateInTopFrameThrows(target, "window.alert(3)");
|
||||
await stepOverToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await reverseStepOverToLine(dbg, 20);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 9);
|
||||
await checkEvaluateInTopFrameThrows(dbg, "window.alert(3)");
|
||||
await stepOverToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -9,21 +9,18 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 22);
|
||||
await rewindToLine(threadFront, 22);
|
||||
await stepInToLine(threadFront, 25);
|
||||
await stepOverToLine(threadFront, 26);
|
||||
await stepOverToLine(threadFront, 27);
|
||||
await reverseStepOverToLine(threadFront, 26);
|
||||
await stepInToLine(threadFront, 30);
|
||||
await stepOverToLine(threadFront, 31);
|
||||
await stepOverToLine(threadFront, 32);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 22);
|
||||
await rewindToLine(dbg, 22);
|
||||
await stepInToLine(dbg, 25);
|
||||
await stepOverToLine(dbg, 26);
|
||||
await stepOverToLine(dbg, 27);
|
||||
await reverseStepOverToLine(dbg, 26);
|
||||
await stepInToLine(dbg, 30);
|
||||
await stepOverToLine(dbg, 31);
|
||||
await stepOverToLine(dbg, 32);
|
||||
|
||||
// Check that the scopes pane shows the value of the local variable.
|
||||
await waitForPaused(dbg);
|
||||
for (let i = 1; ; i++) {
|
||||
if (getScopeLabel(dbg, i) == "c") {
|
||||
is("NaN", getScopeValue(dbg, i));
|
||||
|
@ -31,12 +28,11 @@ add_task(async function() {
|
|||
}
|
||||
}
|
||||
|
||||
await stepOverToLine(threadFront, 33);
|
||||
await reverseStepOverToLine(threadFront, 32);
|
||||
await stepOutToLine(threadFront, 27);
|
||||
await reverseStepOverToLine(threadFront, 26);
|
||||
await reverseStepOverToLine(threadFront, 25);
|
||||
await stepOverToLine(dbg, 33);
|
||||
await reverseStepOverToLine(dbg, 32);
|
||||
await stepOutToLine(dbg, 27);
|
||||
await reverseStepOverToLine(dbg, 26);
|
||||
await reverseStepOverToLine(dbg, 25);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -7,18 +7,15 @@
|
|||
// Test stepping back while recording, then resuming recording.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 13);
|
||||
await resumeToLine(threadFront, 13);
|
||||
const value = await evaluateInTopFrame(target, "number");
|
||||
await reverseStepOverToLine(threadFront, 12);
|
||||
await checkEvaluateInTopFrame(target, "number", value - 1);
|
||||
await resumeToLine(threadFront, 13);
|
||||
await resumeToLine(threadFront, 13);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 1);
|
||||
await addBreakpoint(dbg, "doc_rr_continuous.html", 13);
|
||||
await resumeToLine(dbg, 13);
|
||||
const value = await evaluateInTopFrame(dbg, "number");
|
||||
await reverseStepOverToLine(dbg, 12);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value - 1);
|
||||
await resumeToLine(dbg, 13);
|
||||
await resumeToLine(dbg, 13);
|
||||
await checkEvaluateInTopFrame(dbg, "number", value + 1);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -9,32 +9,29 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadFront, target } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await addBreakpoint(dbg, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
await waitForSelectedLocation(dbg, 21);
|
||||
await reverseStepOverToLine(threadFront, 20);
|
||||
await reverseStepOverToLine(threadFront, 12);
|
||||
await reverseStepOverToLine(dbg, 20);
|
||||
await reverseStepOverToLine(dbg, 12);
|
||||
|
||||
// After reverse-stepping out of the topmost frame we should rewind to the
|
||||
// last breakpoint hit.
|
||||
await reverseStepOverToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await reverseStepOverToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 9);
|
||||
|
||||
await stepOverToLine(threadFront, 22);
|
||||
await stepOverToLine(threadFront, 23);
|
||||
await stepOverToLine(threadFront, 13);
|
||||
await stepOverToLine(threadFront, 17);
|
||||
await stepOverToLine(threadFront, 18);
|
||||
await stepOverToLine(dbg, 22);
|
||||
await stepOverToLine(dbg, 23);
|
||||
await stepOverToLine(dbg, 13);
|
||||
await stepOverToLine(dbg, 17);
|
||||
await stepOverToLine(dbg, 18);
|
||||
|
||||
// After forward-stepping out of the topmost frame we should run forward to
|
||||
// the next breakpoint hit.
|
||||
await stepOverToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await stepOverToLine(dbg, 21);
|
||||
await checkEvaluateInTopFrame(dbg, "number", 10);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -19,11 +19,8 @@ add_task(async function() {
|
|||
const dbg = await attachRecordingDebugger("doc_inspector_basic.html", {
|
||||
waitForRecording: true,
|
||||
disableLogging: true,
|
||||
skipInterrupt: true,
|
||||
});
|
||||
const { threadFront } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
const { inspector } = await openInspector();
|
||||
|
||||
|
@ -31,7 +28,7 @@ add_task(async function() {
|
|||
let container = getContainerForNodeFront(nodeFront, inspector);
|
||||
ok(!container, "No node container while unpaused");
|
||||
|
||||
await threadFront.interrupt();
|
||||
await interrupt(dbg);
|
||||
|
||||
nodeFront = await getNodeFront("#maindiv", inspector);
|
||||
await waitFor(
|
||||
|
@ -43,9 +40,8 @@ add_task(async function() {
|
|||
"Correct late element text"
|
||||
);
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_basic.html", 9);
|
||||
|
||||
await rewindToLine(threadFront, 9);
|
||||
await addBreakpoint(dbg, "doc_inspector_basic.html", 9);
|
||||
await rewindToLine(dbg, 9);
|
||||
|
||||
nodeFront = await getNodeFront("#maindiv", inspector);
|
||||
await waitFor(
|
||||
|
@ -57,6 +53,5 @@ add_task(async function() {
|
|||
"Correct early element text"
|
||||
);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
});
|
||||
|
|
|
@ -15,14 +15,10 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
disableLogging: true,
|
||||
});
|
||||
const { threadFront, toolbox } = dbg;
|
||||
const { toolbox } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_basic.html", 9);
|
||||
await rewindToLine(threadFront, 9);
|
||||
await addBreakpoint(dbg, "doc_inspector_basic.html", 9);
|
||||
await rewindToLine(dbg, 9);
|
||||
|
||||
const { testActor } = await openInspector();
|
||||
|
||||
|
@ -38,7 +34,6 @@ add_task(async function() {
|
|||
info("Performing checks");
|
||||
await testActor.isNodeCorrectlyHighlighted("#maindiv", is);
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
|
||||
function moveMouseOver(selector, x, y) {
|
||||
|
|
|
@ -31,23 +31,15 @@ add_task(async function() {
|
|||
waitForRecording: true,
|
||||
disableLogging: true,
|
||||
});
|
||||
const { threadFront } = dbg;
|
||||
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
await threadFront.interrupt();
|
||||
|
||||
const { inspector, view } = await openComputedView();
|
||||
await checkBackgroundColor("body", "rgb(0, 128, 0)");
|
||||
await checkBackgroundColor("#maindiv", "rgb(0, 0, 255)");
|
||||
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_styles.html", 11);
|
||||
|
||||
await rewindToLine(threadFront, 11);
|
||||
await addBreakpoint(dbg, "doc_inspector_styles.html", 11);
|
||||
await rewindToLine(dbg, 11);
|
||||
await checkBackgroundColor("#maindiv", "rgb(255, 0, 0)");
|
||||
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await shutdownDebugger(dbg);
|
||||
|
||||
async function checkBackgroundColor(node, color) {
|
||||
|
|
|
@ -22,12 +22,14 @@ const EXAMPLE_URL =
|
|||
async function attachDebugger(tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "jsdebugger");
|
||||
return { toolbox, tab, target };
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
const threadFront = dbg.toolbox.threadFront;
|
||||
return { ...dbg, tab, threadFront };
|
||||
}
|
||||
|
||||
async function attachRecordingDebugger(
|
||||
url,
|
||||
{ waitForRecording, disableLogging } = {}
|
||||
{ waitForRecording, disableLogging, skipInterrupt } = {}
|
||||
) {
|
||||
if (!disableLogging) {
|
||||
await pushPref("devtools.recordreplay.logging", true);
|
||||
|
@ -40,41 +42,41 @@ async function attachRecordingDebugger(
|
|||
if (waitForRecording) {
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
}
|
||||
const { target, toolbox } = await attachDebugger(tab);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
const threadFront = dbg.toolbox.threadFront;
|
||||
const dbg = await attachDebugger(tab);
|
||||
|
||||
await threadFront.interrupt();
|
||||
return { ...dbg, tab, threadFront, target };
|
||||
if (!skipInterrupt) {
|
||||
await interrupt(dbg);
|
||||
}
|
||||
|
||||
return dbg;
|
||||
}
|
||||
|
||||
async function waitForPausedNoSource(dbg) {
|
||||
await waitForState(dbg, state => isPaused(dbg), "paused");
|
||||
}
|
||||
|
||||
async function shutdownDebugger(dbg) {
|
||||
await dbg.actions.removeAllBreakpoints(getContext(dbg));
|
||||
await waitForRequestsToSettle(dbg);
|
||||
await dbg.toolbox.destroy();
|
||||
await gBrowser.removeTab(dbg.tab);
|
||||
}
|
||||
|
||||
// Return a promise that resolves when a breakpoint has been set.
|
||||
async function setBreakpoint(threadFront, expectedFile, lineno, options = {}) {
|
||||
const { sources } = await threadFront.getSources();
|
||||
ok(sources.length == 1, "Got one source");
|
||||
ok(RegExp(expectedFile).test(sources[0].url), "Source is " + expectedFile);
|
||||
const location = { sourceUrl: sources[0].url, line: lineno };
|
||||
await threadFront.setBreakpoint(location, options);
|
||||
return location;
|
||||
async function interrupt(dbg) {
|
||||
await dbg.actions.breakOnNext(getThreadContext(dbg));
|
||||
await waitForPausedNoSource(dbg);
|
||||
}
|
||||
|
||||
function resumeThenPauseAtLineFunctionFactory(method) {
|
||||
return async function(threadFront, lineno) {
|
||||
threadFront[method]();
|
||||
await threadFront.once("paused");
|
||||
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
const frameLine = frames[0] ? frames[0].where.line : undefined;
|
||||
ok(
|
||||
frameLine == lineno,
|
||||
"Paused at line " + frameLine + " expected " + lineno
|
||||
);
|
||||
return async function(dbg, lineno) {
|
||||
await dbg.actions[method](getThreadContext(dbg));
|
||||
if (lineno !== undefined) {
|
||||
await waitForPaused(dbg);
|
||||
} else {
|
||||
await waitForPausedNoSource(dbg);
|
||||
}
|
||||
const pauseLine = getVisibleSelectedFrameLine(dbg);
|
||||
ok(pauseLine == lineno, `Paused at line ${pauseLine} expected ${lineno}`);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,9 +93,9 @@ var stepOutToLine = resumeThenPauseAtLineFunctionFactory("stepOut");
|
|||
|
||||
// Return a promise that resolves when a thread evaluates a string in the
|
||||
// topmost frame, with the result throwing an exception.
|
||||
async function checkEvaluateInTopFrameThrows(target, text) {
|
||||
const threadFront = target.threadFront;
|
||||
const consoleFront = await target.getFront("console");
|
||||
async function checkEvaluateInTopFrameThrows(dbg, text) {
|
||||
const threadFront = dbg.toolbox.target.threadFront;
|
||||
const consoleFront = await dbg.toolbox.target.getFront("console");
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
ok(frames.length == 1, "Got one frame");
|
||||
const options = { thread: threadFront.actor, frameActor: frames[0].actor };
|
||||
|
|
Загрузка…
Ссылка в новой задаче