summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/test/mochitest')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js8
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-console-async.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-console.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-dom-mutation-breakpoints.js4
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-es-module-worker.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-log-events.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-log-point-mapping.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-log-points-workers.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-log-points.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused-anonymous.js9
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-preview.js40
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-source-pragma.js3
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js3
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-step-in-navigate.js3
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers-reload.js3
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js9
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js7
-rw-r--r--devtools/client/debugger/test/mochitest/shared-head.js20
20 files changed, 80 insertions, 47 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js
index eba02919d3..8a7ac18df4 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js
@@ -70,8 +70,7 @@ add_task(async function testPausedByBreakpoint() {
info("Open the popup in order to be able to set a breakpoint");
const firstPopupBrowsingContext = await openPopup(POPUP_URL);
- await waitForSource(dbg, POPUP_URL);
- const source = findSource(dbg, POPUP_URL);
+ let source = await waitForSource(dbg, POPUP_URL);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 4);
@@ -88,7 +87,7 @@ add_task(async function testPausedByBreakpoint() {
"The popup is really paused"
);
- await waitForSource(dbg, POPUP_URL);
+ source = await waitForSource(dbg, POPUP_URL);
assertPausedAtSourceAndLine(dbg, source.id, 4);
await resume(dbg);
@@ -131,8 +130,7 @@ add_task(async function testPausedInTwoPopups() {
const browser = gBrowser.selectedBrowser;
const popupBrowsingContext = await openPopup(POPUP_URL);
- await waitForSource(dbg, POPUP_URL);
- const source = findSource(dbg, POPUP_URL);
+ const source = await waitForSource(dbg, POPUP_URL);
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 4);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js b/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
index d461918d7a..4d8720d395 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
@@ -19,6 +19,8 @@ add_task(async function () {
const button = toggleButton(dbg);
ok(!button, "toggle button shouldn't be there");
+
+ await resume(dbg);
});
add_task(async function () {
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js b/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
index 4c669766b0..caa122eb24 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
@@ -9,7 +9,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
Services.prefs.setBoolPref(
"devtools.debugger.features.map-await-expression",
true
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js b/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
index 26529a75cd..085b048fb6 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
@@ -5,7 +5,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
const dbg = await initDebugger("doc-strict.html");
await getSplitConsole(dbg);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-console.js b/devtools/client/debugger/test/mochitest/browser_dbg-console.js
index a725f7de43..73a5780cc6 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console.js
@@ -5,7 +5,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
const dbg = await initDebugger(
"doc-script-switching.html",
"script-switching-01.js"
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-dom-mutation-breakpoints.js b/devtools/client/debugger/test/mochitest/browser_dbg-dom-mutation-breakpoints.js
index e26ca0493b..de10014069 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-dom-mutation-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-dom-mutation-breakpoints.js
@@ -146,9 +146,7 @@ add_task(async function () {
await resume(dbg);
info("Blackboxing the source prevents debugger pause");
- await waitForSource(dbg, "dom-mutation.original.js");
-
- const source = findSource(dbg, "dom-mutation.original.js");
+ const source = await waitForSource(dbg, "dom-mutation.original.js");
await selectSource(dbg, source);
await clickElement(dbg, "blackbox");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-es-module-worker.js b/devtools/client/debugger/test/mochitest/browser_dbg-es-module-worker.js
index 93123187e1..f9b299991f 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-es-module-worker.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-es-module-worker.js
@@ -40,7 +40,7 @@ add_task(async function () {
is(threads.length, 1, "Got the page and the worker threads");
is(threads[0].name, WORKER_URL, "Thread name is correct");
- const source = findSource(dbg, "worker.js");
+ const source = await waitForSource(dbg, "worker.js");
await selectSource(dbg, source);
await addBreakpoint(dbg, source, 3);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-log-events.js b/devtools/client/debugger/test/mochitest/browser_dbg-log-events.js
index 6ce0acbc77..e857a38654 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-log-events.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-log-events.js
@@ -9,7 +9,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
const dbg = await initDebugger(
"doc-event-breakpoints.html",
"event-breakpoints.js"
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-log-point-mapping.js b/devtools/client/debugger/test/mochitest/browser_dbg-log-point-mapping.js
index 67886672b6..521e59b270 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-log-point-mapping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-log-point-mapping.js
@@ -9,7 +9,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
await pushPref("devtools.debugger.map-scopes-enabled", true);
const dbg = await initDebugger("doc-sourcemaps3.html", "test.js");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-log-points-workers.js b/devtools/client/debugger/test/mochitest/browser_dbg-log-points-workers.js
index aa52904d31..3475d3f41d 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-log-points-workers.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-log-points-workers.js
@@ -9,7 +9,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
const dbg = await initDebugger("doc-windowless-workers.html");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-log-points.js b/devtools/client/debugger/test/mochitest/browser_dbg-log-points.js
index d265caa0ad..ea3fecf1ec 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-log-points.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-log-points.js
@@ -9,7 +9,7 @@
"use strict";
add_task(async function () {
- Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
+ Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true);
const dbg = await initDebugger(
"doc-script-switching.html",
"script-switching-01.js"
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused-anonymous.js b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused-anonymous.js
index 8d3771cae9..223f401c73 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused-anonymous.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused-anonymous.js
@@ -22,8 +22,7 @@ add_task(async function () {
const prettyEvaluatedSourceFilename =
evaluatedSourceId.split("/").at(-1) + ":formatted";
- await waitForSource(dbg, prettyEvaluatedSourceFilename);
- const prettySource = findSource(dbg, prettyEvaluatedSourceFilename);
+ const prettySource = await waitForSource(dbg, prettyEvaluatedSourceFilename);
info("Check that the script was pretty-printed as expected");
const { value: prettySourceValue } = findSourceContent(dbg, prettySource);
@@ -67,8 +66,7 @@ document.addEventListener('click', e => {
const prettyEvalSourceFilename =
evalSourceId.split("/").at(-1) + ":formatted";
- await waitForSource(dbg, prettyEvalSourceFilename);
- const prettyEvalSource = findSource(dbg, prettyEvalSourceFilename);
+ const prettyEvalSource = await waitForSource(dbg, prettyEvalSourceFilename);
info("Check that the script was pretty-printed as expected");
const { value: prettyEvalSourceValue } = findSourceContent(
@@ -113,8 +111,7 @@ setTimeout(
const prettyNewFunctionSourceFilename =
newFunctionSourceId.split("/").at(-1) + ":formatted";
- await waitForSource(dbg, prettyNewFunctionSourceFilename);
- const prettyNewFunctionSource = findSource(
+ const prettyNewFunctionSource = await waitForSource(
dbg,
prettyNewFunctionSourceFilename
);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-preview.js b/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
index 532854548c..b7bb67c7d8 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
@@ -158,6 +158,46 @@ async function testHoveringInvalidTargetTokens(dbg) {
is(raceResult, "TIMEOUT", "No popup was displayed over the inline preview");
await resume(dbg);
+
+ info("Test hovering element not in a line");
+ await getDebuggerSplitConsole(dbg);
+ const { hud } = dbg.toolbox.getPanel("webconsole");
+ evaluateExpressionInConsole(
+ hud,
+ `
+ a = 1;
+ debugger;
+ b = 2;`
+ );
+ await waitForPaused(dbg);
+ await dbg.toolbox.toggleSplitConsole();
+
+ resetCursorPositionToTopLeftCorner(dbg);
+
+ const racePromiseLines = Promise.any([
+ waitForElement(dbg, "previewPopup"),
+ wait(500).then(() => "TIMEOUT_LINES"),
+ ]);
+ // We don't want to use hoverToken, as it synthesize the event at the center of the element,
+ // which wouldn't reproduce the original issue we want to check
+ EventUtils.synthesizeMouse(
+ findElementWithSelector(dbg, ".CodeMirror-lines"),
+ 0,
+ 0,
+ {
+ type: "mousemove",
+ },
+ dbg.win
+ );
+ is(
+ await racePromiseLines,
+ "TIMEOUT_LINES",
+ "No popup was displayed over the .CodeMirror-lines element"
+ );
+
+ // Resume and select back the main JS file that is used by the other assertions
+ await resume(dbg);
+ await selectSource(dbg, "preview.js");
}
async function assertNoPreviews(dbg, expression, line, column) {
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-source-pragma.js b/devtools/client/debugger/test/mochitest/browser_dbg-source-pragma.js
index edca4e2b80..82fbd911ac 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-source-pragma.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-source-pragma.js
@@ -13,8 +13,7 @@ add_task(async function () {
const dbg = await initDebugger("doc-source-pragma.html");
// The sourceURL pragma didn't rename the source
- await waitForSource(dbg, "source-pragma.js");
- const source = findSource(dbg, "source-pragma.js");
+ const source = await waitForSource(dbg, "source-pragma.js");
const actors = dbg.selectors.getSourceActorsForSource(source.id);
is(actors.length, 1, "have a single actor");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js b/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
index 0dc81605c9..2f07390c48 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
@@ -149,8 +149,9 @@ add_task(async function testBreakpointsPanePersistOnPauseToggle() {
is(getPaneElements(dbg).length, 1, "Breakpoint pane is closed");
info("Check event listener breakpoints log box");
-
+ const wait = waitForDispatch(dbg.store, "TOGGLE_EVENT_LISTENERS");
await clickElement(dbg, "logEventsCheckbox");
+ await wait;
is(getPaneElements(dbg).length, 1, "Breakpoint pane is still closed");
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-step-in-navigate.js b/devtools/client/debugger/test/mochitest/browser_dbg-step-in-navigate.js
index 53d66c6f12..85dff42104 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-step-in-navigate.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-step-in-navigate.js
@@ -24,11 +24,10 @@ add_task(async function () {
await addBreakpoint(dbg, "long.js", 1);
// Navigation should clear the stepping state
- const reloaded = reload(dbg);
+ const reloaded = reload(dbg, "simple2.js");
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, findSource(dbg, "long.js").id, 1);
await resume(dbg);
await reloaded;
- await waitForSource(dbg, "simple3.js");
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers-reload.js b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers-reload.js
index 1638cb9722..9256f91c2f 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers-reload.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers-reload.js
@@ -17,8 +17,7 @@ add_task(async function () {
const dbg = await initDebugger("doc-service-workers.html");
invokeInTab("registerWorker");
- await waitForSource(dbg, "service-worker.sjs");
- const workerSource = findSource(dbg, "service-worker.sjs");
+ const workerSource = await waitForSource(dbg, "service-worker.sjs");
await reload(dbg, "service-worker.sjs");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
index f2e20f4541..c89541871b 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
@@ -22,8 +22,7 @@ add_task(async function () {
);
invokeInTab("registerWorker");
- await waitForSource(dbg, "service-worker.sjs");
- const workerSource = findSource(dbg, "service-worker.sjs");
+ const workerSource = await waitForSource(dbg, "service-worker.sjs");
await addBreakpoint(dbg, "service-worker.sjs", 13);
@@ -52,8 +51,7 @@ add_task(async function () {
// The test page will immediately fetch from the service worker if registered.
const onReloaded = reload(dbg);
- await waitForSource(dbg, "service-worker.sjs");
- const workerSource = findSource(dbg, "service-worker.sjs");
+ const workerSource = await waitForSource(dbg, "service-worker.sjs");
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 13);
@@ -140,8 +138,7 @@ add_task(async function () {
invokeInTab("registerWorker");
await checkAdditionalThreadCount(dbg, 1);
- await waitForSource(dbg, "service-worker.sjs");
- const workerSource = findSource(dbg, "service-worker.sjs");
+ const workerSource = await waitForSource(dbg, "service-worker.sjs");
await waitForBreakpointCount(dbg, 1);
await waitForPaused(dbg);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
index ffe362b44f..49decefd1c 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
@@ -10,7 +10,10 @@
add_task(async function () {
await pushPref("devtools.debugger.threads-visible", true);
- const dbg = await initDebugger("doc-windowless-workers.html");
+ const dbg = await initDebugger(
+ "doc-windowless-workers.html",
+ "simple-worker.js"
+ );
const mainThread = dbg.toolbox.threadFront.actor;
await waitForThreadCount(dbg, 2);
@@ -21,8 +24,6 @@ add_task(async function () {
const mainThreadSource = findSource(dbg, "doc-windowless-workers.html");
- await waitForSource(dbg, "simple-worker.js");
-
info("Pause in the main thread");
assertNotPaused(dbg);
await dbg.actions.breakOnNext();
diff --git a/devtools/client/debugger/test/mochitest/shared-head.js b/devtools/client/debugger/test/mochitest/shared-head.js
index b2a1c7c3d7..fe3ab0171c 100644
--- a/devtools/client/debugger/test/mochitest/shared-head.js
+++ b/devtools/client/debugger/test/mochitest/shared-head.js
@@ -68,25 +68,27 @@ const DEBUGGER_L10N = new LocalizationHelper(
/**
* Waits for `predicate()` to be true. `state` is the redux app state.
*
- * @memberof mochitest/waits
* @param {Object} dbg
* @param {Function} predicate
+ * @param {String} msg
* @return {Promise}
- * @static
*/
-function waitForState(dbg, predicate, msg) {
+function waitForState(dbg, predicate, msg = "") {
return new Promise(resolve => {
- info(`Waiting for state change: ${msg || ""}`);
- if (predicate(dbg.store.getState())) {
- info(`Finished waiting for state change: ${msg || ""}`);
- resolve();
+ info(`Waiting for state change: ${msg}`);
+ let result = predicate(dbg.store.getState());
+ if (result) {
+ info(
+ `--> The state was immediately correct (should rather do an immediate assertion?)`
+ );
+ resolve(result);
return;
}
const unsubscribe = dbg.store.subscribe(() => {
- const result = predicate(dbg.store.getState());
+ result = predicate(dbg.store.getState());
if (result) {
- info(`Finished waiting for state change: ${msg || ""}`);
+ info(`Finished waiting for state change: ${msg}`);
unsubscribe();
resolve(result);
}