Created
August 9, 2019 20:54
-
-
Save jasonLaster/518a8c65b7deb0752a7c4f1f71464020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit fd0d04db1dc79cc4db09ad9ec28a7bacdc6c6bc4 | |
Author: Jason Laster <jlaster@mozilla.com> | |
Date: Fri Aug 9 13:53:59 2019 -0700 | |
Bug 1572850 - Refactor resumeThenPauseAtLineFunctionFactory to use dbg helpers. | |
diff --git a/devtools/client/debugger/test/mochitest/helpers.js b/devtools/client/debugger/test/mochitest/helpers.js | |
index 7106e3f236c8..ab23d8974c51 100644 | |
--- a/devtools/client/debugger/test/mochitest/helpers.js | |
+++ b/devtools/client/debugger/test/mochitest/helpers.js | |
@@ -762,6 +762,7 @@ function resume(dbg) { | |
return dbg.actions.resume(getThreadContext(dbg)); | |
} | |
+ | |
function deleteExpression(dbg, input) { | |
info(`Delete expression "${input}"`); | |
return dbg.actions.deleteExpression({ input }); | |
@@ -981,9 +982,9 @@ async function assertScopes(dbg, items) { | |
* @static | |
*/ | |
function removeBreakpoint(dbg, sourceId, line, column) { | |
- const source = dbg.selectors.getSource(sourceId); | |
- column = column || getFirstBreakpointColumn(dbg, { line, sourceId }); | |
- const location = { sourceId, sourceUrl: source.url, line, column }; | |
+ const source = findSource(dbg, sourceId); | |
+ column = column || getFirstBreakpointColumn(dbg, { line, sourceId: source.id }); | |
+ const location = { sourceId: source.id, sourceUrl: source.url, line, column }; | |
const bp = dbg.selectors.getBreakpointForLocation(location); | |
return dbg.actions.removeBreakpoint(getContext(dbg), bp); | |
} | |
diff --git a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-01.js b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-01.js | |
index 7e4e2a207532..5d95270bc159 100644 | |
--- a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-01.js | |
+++ b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-01.js | |
@@ -11,18 +11,17 @@ 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 dbg.threadFront.interrupt(); | |
+ addBreakpoint(dbg, "doc_rr_basic.html", 21); | |
+ await rewindToLine(dbg, 21); | |
+ await checkEvaluateInTopFrame(dbg.target, "number", 10); | |
+ await reverseStepOverToLine(dbg, 20); | |
+ await checkEvaluateInTopFrame(dbg.target, "number", 9); | |
+ await checkEvaluateInTopFrameThrows(dbg.target, "window.alert(3)"); | |
+ await stepOverToLine(dbg, 21); | |
+ await checkEvaluateInTopFrame(dbg.target, "number", 10); | |
- await threadFront.removeBreakpoint(bp); | |
+ await removeBreakpoint(dbg, "doc_rr_basic.html", 21); | |
await shutdownDebugger(dbg); | |
}); | |
diff --git a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js | |
index ee9705402c9c..1761d7a4fffa 100644 | |
--- a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js | |
+++ b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js | |
@@ -11,24 +11,23 @@ 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 stepOverToLine(threadFront, 33); | |
- await reverseStepOverToLine(threadFront, 32); | |
- await stepOutToLine(threadFront, 27); | |
- await reverseStepOverToLine(threadFront, 26); | |
- await reverseStepOverToLine(threadFront, 25); | |
+ await dbg.threadFront.interrupt(); | |
+ 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); | |
+ 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 removeBreakpoint(dbg, "doc_rr_basic.html", 22); | |
await shutdownDebugger(dbg); | |
}); | |
diff --git a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-03.js b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-03.js | |
index 0e11636663a5..40ce30dd0ded 100644 | |
--- a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-03.js | |
+++ b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-03.js | |
@@ -12,15 +12,15 @@ add_task(async function() { | |
const { threadFront, target } = dbg; | |
await threadFront.interrupt(); | |
- const bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 13); | |
- await resumeToLine(threadFront, 13); | |
+ await addBreakpoint(dbg, "doc_rr_continuous.html", 13); | |
+ await resumeToLine(dbg, 13); | |
const value = await evaluateInTopFrame(target, "number"); | |
- await reverseStepOverToLine(threadFront, 12); | |
+ await reverseStepOverToLine(dbg, 12); | |
await checkEvaluateInTopFrame(target, "number", value - 1); | |
- await resumeToLine(threadFront, 13); | |
- await resumeToLine(threadFront, 13); | |
+ await resumeToLine(dbg, 13); | |
+ await resumeToLine(dbg, 13); | |
await checkEvaluateInTopFrame(target, "number", value + 1); | |
- await threadFront.removeBreakpoint(bp); | |
+ await removeBreakpoint(dbg, "doc_rr_continuous.html", 13); | |
await shutdownDebugger(dbg); | |
}); | |
diff --git a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-04.js b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-04.js | |
index 565949e2cfb4..91350a34878c 100644 | |
--- a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-04.js | |
+++ b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-04.js | |
@@ -14,29 +14,29 @@ add_task(async function() { | |
const { threadFront, target } = dbg; | |
await threadFront.interrupt(); | |
- const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21); | |
- await rewindToLine(threadFront, 21); | |
+ const bp = await addBreakpoint(dbg, "doc_rr_basic.html", 21); | |
+ await rewindToLine(dbg, 21); | |
await checkEvaluateInTopFrame(target, "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 reverseStepOverToLine(dbg, 21); | |
await checkEvaluateInTopFrame(target, "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 stepOverToLine(dbg, 21); | |
await checkEvaluateInTopFrame(target, "number", 10); | |
- await threadFront.removeBreakpoint(bp); | |
+ await removeBreakpoint(dbg, "doc_rr_basic.html", 21); | |
await shutdownDebugger(dbg); | |
}); | |
diff --git a/devtools/client/webreplay/mochitest/head.js b/devtools/client/webreplay/mochitest/head.js | |
index 07b7c986b54c..c345ad48d033 100644 | |
--- a/devtools/client/webreplay/mochitest/head.js | |
+++ b/devtools/client/webreplay/mochitest/head.js | |
@@ -63,16 +63,10 @@ async function setBreakpoint(threadFront, expectedFile, lineno, options = {}) { | |
} | |
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, line) { | |
+ await dbg.actions[method](getThreadContext(dbg)); | |
+ await waitForPaused(dbg); | |
+ await waitForSelectedLocation(dbg, line); | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment