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_aj.toml3
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js16
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js10
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js14
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js8
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-editor-select.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-features-source-tree.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-function-returns.js8
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-interation.js10
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-load.js4
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-worker.js4
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js12
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js5
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-outline.js37
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-overrides.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-pause-on-next.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay.js36
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-react-app.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-search-file.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-slow-script.js12
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-bogus.js29
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js29
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js5
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js50
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-ua-widgets.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js2
-rw-r--r--devtools/client/debugger/test/mochitest/browser_kz.toml3
-rw-r--r--devtools/client/debugger/test/mochitest/shared-head.js81
36 files changed, 307 insertions, 101 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_aj.toml b/devtools/client/debugger/test/mochitest/browser_aj.toml
index cbedf75eae..fe154b8149 100644
--- a/devtools/client/debugger/test/mochitest/browser_aj.toml
+++ b/devtools/client/debugger/test/mochitest/browser_aj.toml
@@ -198,6 +198,9 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
["browser_dbg-features-asm.js"]
["browser_dbg-features-breakable-lines.js"]
+skip-if = [
+ "apple_catalina && !debug", # Bug 1767701
+]
["browser_dbg-features-breakable-positions.js"]
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
index 8080d3c145..42eec2716c 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
@@ -200,7 +200,7 @@ add_task(async function testHideAndShowBlackBoxedFiles() {
function waitForBlackboxCount(dbg, count) {
return waitForState(
dbg,
- state => Object.keys(dbg.selectors.getBlackBoxRanges()).length === count
+ () => Object.keys(dbg.selectors.getBlackBoxRanges()).length === count
);
}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
index c766a0e549..f995df2b6b 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
@@ -15,9 +15,9 @@ add_task(async function () {
info("Adding a breakpoint should remove the skipped pausing state");
await skipPausing(dbg);
- await waitForState(dbg, state => dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => dbg.selectors.getSkipPausing());
await addBreakpoint(dbg, "simple3.js", 2);
- await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => !dbg.selectors.getSkipPausing());
invokeInTab("simple");
await waitForPaused(dbg);
ok(true, "The breakpoint has been hit after a breakpoint was created");
@@ -28,13 +28,13 @@ add_task(async function () {
// during a disable
await skipPausing(dbg);
await disableBreakpoint(dbg, 0);
- await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => !dbg.selectors.getSkipPausing());
// Then re-enable the breakpoint to ensure skip pausing gets turned off
// during an enable
await skipPausing(dbg);
- await waitForState(dbg, state => dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => dbg.selectors.getSkipPausing());
toggleBreakpoint(dbg, 0);
- await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => !dbg.selectors.getSkipPausing());
await waitForDispatch(dbg.store, "SET_BREAKPOINT");
invokeInTab("simple");
await waitForPaused(dbg);
@@ -45,7 +45,7 @@ add_task(async function () {
await addBreakpoint(dbg, "simple3.js", 3);
await skipPausing(dbg);
await disableBreakpoint(dbg, 0);
- await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => !dbg.selectors.getSkipPausing());
invokeInTab("simple");
await waitForPaused(dbg);
ok(true, "The breakpoint has been hit after skip pausing was disabled again");
@@ -57,7 +57,7 @@ add_task(async function () {
const source = findSource(dbg, "simple3.js");
removeBreakpoint(dbg, source.id, 3);
const wait = waitForDispatch(dbg.store, "TOGGLE_SKIP_PAUSING");
- await waitForState(dbg, state => !dbg.selectors.getSkipPausing());
+ await waitForState(dbg, () => !dbg.selectors.getSkipPausing());
await wait;
invokeInTab("simple");
await waitForPaused(dbg);
@@ -70,7 +70,7 @@ add_task(async function () {
function skipPausing(dbg) {
clickElementWithSelector(dbg, ".command-bar-skip-pausing");
- return waitForState(dbg, state => dbg.selectors.getSkipPausing());
+ return waitForState(dbg, () => dbg.selectors.getSkipPausing());
}
function toggleBreakpoint(dbg, index) {
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
index 900c55e7fa..4150f552a1 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
@@ -16,7 +16,7 @@ add_task(async function () {
// select "Remove breakpoint"
selectContextMenuItem(dbg, selectors.breakpointContextMenu.remove);
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() === 0);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() === 0);
ok(true, "successfully removed the breakpoint");
});
@@ -34,7 +34,7 @@ add_task(async function () {
// select "Disable Others"
let dispatched = waitForDispatch(dbg.store, "SET_BREAKPOINT", 2);
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableOthers);
- await waitForState(dbg, state =>
+ await waitForState(dbg, () =>
dbg.selectors
.getBreakpointsList()
.every(bp => (bp.location.line !== 4) === bp.disabled)
@@ -46,7 +46,7 @@ add_task(async function () {
// select "Disable All"
dispatched = waitForDispatch(dbg.store, "SET_BREAKPOINT");
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableAll);
- await waitForState(dbg, state =>
+ await waitForState(dbg, () =>
dbg.selectors.getBreakpointsList().every(bp => bp.disabled)
);
await dispatched;
@@ -56,7 +56,7 @@ add_task(async function () {
// select "Enable Others"
dispatched = waitForDispatch(dbg.store, "SET_BREAKPOINT", 2);
selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableOthers);
- await waitForState(dbg, state =>
+ await waitForState(dbg, () =>
dbg.selectors
.getBreakpointsList()
.every(bp => (bp.location.line === 4) === bp.disabled)
@@ -70,7 +70,7 @@ add_task(async function () {
selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeOthers);
await waitForState(
dbg,
- state =>
+ () =>
dbg.selectors.getBreakpointsList().length === 1 &&
dbg.selectors.getBreakpointsList()[0].location.line === 4
);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
index 6234e22dcb..b48c2d162a 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
@@ -36,7 +36,10 @@ add_task(async function () {
await setConditionalBreakpoint(dbg, 1, "foo2");
info("10. Test removing the breakpoints by clicking in the gutter");
- await removeAllBreakpoints(dbg, 32, 0);
+ await clickGutter(dbg, 32);
+ await waitForBreakpointCount(dbg, 0);
+
+ ok(!findAllElements(dbg, "columnBreakpoints").length);
});
async function enableFirstBreakpoint(dbg) {
@@ -106,7 +109,7 @@ async function disableBreakpoint(dbg, index) {
await waitForContextMenu(dbg);
selectContextMenuItem(dbg, selectors.disableItem);
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
const bp = dbg.selectors.getBreakpointsList()[index];
return bp.disabled;
});
@@ -122,10 +125,3 @@ async function removeFirstBreakpoint(dbg) {
bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
assertClass(bpMarkers[0], "active", false);
}
-
-async function removeAllBreakpoints(dbg, line, count) {
- await clickGutter(dbg, 32);
- await waitForBreakpointCount(dbg, 0);
-
- ok(!findAllElements(dbg, "columnBreakpoints").length);
-}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
index bb1fa3d64b..ef12144cdb 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
@@ -20,7 +20,7 @@ add_task(async function () {
await reload(dbg, "doc-duplicate-functions.html");
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 1);
const firstBreakpoint = dbg.selectors.getBreakpointsList()[0];
is(firstBreakpoint.location.line, 21, "Breakpoint is on line 21");
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 a3b7753738..eba02919d3 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-popup.js
@@ -23,7 +23,7 @@ const POPUP_DEBUGGER_STATEMENT_URL = `https://example.com/document-builder.sjs?h
`)}`;
function isPopupPaused(popupBrowsingContext) {
- return SpecialPowers.spawn(popupBrowsingContext, [], function (url) {
+ return SpecialPowers.spawn(popupBrowsingContext, [], function () {
return content.wrappedJSObject.paused;
});
}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
index ca953445ba..6e1f4582fd 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
@@ -38,7 +38,7 @@ add_task(async function () {
await assertPausedAtSourceAndLine(dbg, source.id, 61);
info("The breakpoint for long.js does not exist yet");
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 2);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 2);
// The breakpoints are available once their corresponding source
// has been processed. Let's assert that all the breakpoints for
@@ -54,7 +54,7 @@ add_task(async function () {
await assertPausedAtSourceAndLine(dbg, source2.id, 1);
info("All 3 breakpoints from simple1.js and long.js still exist");
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 3);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 3);
await assertBreakpoint(dbg, 1);
@@ -89,7 +89,7 @@ add_task(async function () {
await assertPausedAtSourceAndLine(dbg, source.id, 22);
info("Only the breakpoint for the first inline script should exist");
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 1);
await assertBreakpoint(dbg, 22);
@@ -102,7 +102,7 @@ add_task(async function () {
await waitForPaused(dbg);
info("All 2 breakpoints from both inline scripts still exist");
- await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 2);
+ await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 2);
await assertPausedAtSourceAndLine(dbg, source.id, 27);
await assertBreakpoint(dbg, 27);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-editor-select.js b/devtools/client/debugger/test/mochitest/browser_dbg-editor-select.js
index c0c6c03a43..85467d2347 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-editor-select.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-editor-select.js
@@ -32,6 +32,7 @@ add_task(async function () {
// Note that CodeMirror is 0-based while the footer displays 1-based
getCM(dbg).setCursor({ line: 1, ch: 0 });
+ await waitForCursorPosition(dbg, 2);
assertCursorPosition(
dbg,
2,
@@ -44,6 +45,7 @@ add_task(async function () {
);
getCM(dbg).setCursor({ line: 2, ch: 0 });
+ await waitForCursorPosition(dbg, 3);
assertCursorPosition(
dbg,
3,
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js b/devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js
index fa321f5f43..539b273697 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js
@@ -56,6 +56,8 @@ add_task(async function testSourceTreeNamesForWebExtensions() {
});
await ToolboxTask.spawn(null, async () => {
+ // Disable autofixing to `Assert` methods which are not available here.
+ /* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
try {
/* global gToolbox */
// Wait for the debugger to finish loading.
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-features-source-tree.js b/devtools/client/debugger/test/mochitest/browser_dbg-features-source-tree.js
index f4fdd30898..4590f0c2b3 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-features-source-tree.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-features-source-tree.js
@@ -124,7 +124,7 @@ add_task(async function testSimpleSourcesWithManualClickExpand() {
info("Test the download file context menu");
// Before trigerring the menu, mock the file picker
const MockFilePicker = SpecialPowers.MockFilePicker;
- MockFilePicker.init(window);
+ MockFilePicker.init(window.browsingContext);
const nsiFile = new FileUtils.File(
PathUtils.join(PathUtils.tempDir, `export_source_content_${Date.now()}.log`)
);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-function-returns.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-function-returns.js
index 4b75be5cd7..12102e602d 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-function-returns.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-function-returns.js
@@ -29,7 +29,7 @@ add_task(async function testTracingFunctionReturn() {
const topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -42,7 +42,7 @@ add_task(async function testTracingFunctionReturn() {
await clickElement(dbg, "trace");
info("Wait for tracing to be disabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return !dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -55,7 +55,7 @@ add_task(async function testTracingFunctionReturn() {
await clickElement(dbg, "trace");
info("Wait for tracing to be re-enabled with logging of returned values");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -81,7 +81,7 @@ add_task(async function testTracingFunctionReturn() {
info("Stop tracing");
await clickElement(dbg, "trace");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return !dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-interation.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-interation.js
index 37e275f273..8d3b2ae6f2 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-interation.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-interation.js
@@ -64,7 +64,7 @@ add_task(async function testTracingOnNextInteraction() {
let topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -96,7 +96,7 @@ add_task(async function testTracingOnNextInteraction() {
topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be disabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return !dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -127,7 +127,7 @@ add_task(async function testInteractionBetweenDebuggerAndConsole() {
const topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -159,7 +159,7 @@ add_task(async function testInteractionBetweenDebuggerAndConsole() {
is(msg.textContent.trim(), "Started tracing to Web Console");
info("Wait for tracing to be also enabled in the debugger");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
ok(true, "Debugger also reports the tracing in progress");
@@ -172,7 +172,7 @@ add_task(async function testInteractionBetweenDebuggerAndConsole() {
await clickElement(dbg, "trace");
info("Wait for tracing to be disabled per debugger button");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-load.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-load.js
index 6ee442cbd0..b4259d5eb6 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-load.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-next-load.js
@@ -80,7 +80,7 @@ add_task(async function testTracingOnNextLoad() {
let topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled after page reload");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
ok(
@@ -105,7 +105,7 @@ add_task(async function testTracingOnNextLoad() {
topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be disabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
await waitFor(() => {
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
index 92ff3c30a4..99ce73ac9d 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
@@ -28,7 +28,7 @@ add_task(async function testTracingValues() {
const topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-worker.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-worker.js
index cabcb1deb8..df91b71e0f 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-worker.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-worker.js
@@ -41,7 +41,7 @@ add_task(async function testTracingWorker() {
info("Enable tracing on all threads");
await clickElement(dbg, "trace");
info("Wait for tracing to be enabled for the worker");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(
workerTarget.threadFront.actorID
);
@@ -56,7 +56,7 @@ add_task(async function testTracingWorker() {
content.worker.postMessage("foo");
});
- await hasConsoleMessage(dbg, "DOM(message)");
+ await hasConsoleMessage(dbg, "DOM | message");
await hasConsoleMessage(dbg, "λ onmessage");
await dbg.toolbox.closeToolbox();
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
index 9292e1ba17..bfa2447474 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
@@ -18,7 +18,7 @@ add_task(async function () {
const topLevelThreadActorID =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -52,7 +52,7 @@ add_task(async function () {
gBrowser.selectedBrowser
);
- await hasConsoleMessage(dbg, "DOM(click)");
+ await hasConsoleMessage(dbg, "DOM | click");
await hasConsoleMessage(dbg, "λ simple");
// Test Blackboxing
@@ -90,7 +90,7 @@ add_task(async function () {
info("Disable the tracing");
await clickElement(dbg, "trace");
info("Wait for tracing to be disabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return !dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
await hasConsoleMessage(dbg, "Stopped tracing");
@@ -116,7 +116,7 @@ add_task(async function () {
const newTopLevelThread =
dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
info("Wait for tracing to be re-enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(newTopLevelThread);
});
@@ -216,7 +216,7 @@ add_task(async function testPageKeyShortcut() {
});
info("Wait for tracing to be enabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
@@ -236,7 +236,7 @@ add_task(async function testPageKeyShortcut() {
});
info("Wait for tracing to be disabled");
- await waitForState(dbg, state => {
+ await waitForState(dbg, () => {
return !dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
});
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js b/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
index 609879c7b1..0f006c61fe 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
@@ -46,10 +46,7 @@ async function testLayout(dbg, orientation, host) {
await switchHost(dbg, host);
await resizeToolboxWindow(dbg, host);
- return waitForState(
- dbg,
- state => dbg.selectors.getOrientation() == orientation
- );
+ return waitForState(dbg, () => dbg.selectors.getOrientation() == orientation);
}
function getHost(host) {
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-outline.js b/devtools/client/debugger/test/mochitest/browser_dbg-outline.js
index 6048a7a92d..bfc1c846d1 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-outline.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline.js
@@ -6,6 +6,41 @@
"use strict";
+// Test that the outline panel updates correctly when a source is selected
+// This scenario covers the case where the outline panel always focused.
+add_task(async function () {
+ const dbg = await initDebugger("doc-scripts.html", "simple1.js");
+ openOutlinePanel(dbg, false);
+ is(
+ findAllElements(dbg, "outlineItems").length,
+ 0,
+ " There are no outline items when no source is selected"
+ );
+
+ await selectSource(dbg, "simple1.js", 1);
+
+ info("Wait for all the outline list to load");
+ await waitForElementWithSelector(dbg, ".outline-list");
+
+ assertOutlineItems(dbg, [
+ "λmain()",
+ "λdoEval()",
+ "λevaledFunc()",
+ "λdoNamedEval()",
+ // evaledFunc is set twice
+ "λevaledFunc()",
+ "class MyClass",
+ "λconstructor(a, b)",
+ "λtest()",
+ "λ#privateFunc(a, b)",
+ "class Klass",
+ "λconstructor()",
+ "λtest()",
+ ]);
+});
+
+// Test that the outline panel updates correctly when a source is selected
+// This scenario covers the case where the outline panel gets un-selected and selected again
add_task(async function () {
const dbg = await initDebugger("doc-scripts.html", "simple1.js");
@@ -73,7 +108,7 @@ add_task(async function () {
]);
});
-// Test empty panel when source has not function or class symbols
+// Test empty panel when source has no function or class symbols
add_task(async function () {
const dbg = await initDebugger("doc-on-load.html", "top-level.js");
await selectSource(dbg, "top-level.js", 1);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-overrides.js b/devtools/client/debugger/test/mochitest/browser_dbg-overrides.js
index 48f5893799..0e2dc54609 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-overrides.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-overrides.js
@@ -70,7 +70,7 @@ add_task(async function () {
info("Select test.js tree node, and add override");
const MockFilePicker = SpecialPowers.MockFilePicker;
- MockFilePicker.init(window);
+ MockFilePicker.init(window.browsingContext);
const nsiFile = new FileUtils.File(
PathUtils.join(PathUtils.tempDir, "test.js")
);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pause-on-next.js b/devtools/client/debugger/test/mochitest/browser_dbg-pause-on-next.js
index 27ae30983f..ee27554280 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-on-next.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-on-next.js
@@ -13,7 +13,7 @@ add_task(async function () {
} = dbg;
clickElement(dbg, "pause");
- await waitForState(dbg, state => getIsWaitingOnBreak(getCurrentThread()));
+ await waitForState(dbg, () => getIsWaitingOnBreak(getCurrentThread()));
invokeInTab("simple");
await waitForPaused(dbg, "simple3");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js b/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
index 456e4e10f5..3590395701 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
@@ -14,7 +14,7 @@ async function testCase(dbg, { name, steps }) {
} = dbg;
const locations = [];
- const recordFrame = state => {
+ const recordFrame = () => {
const { line, column } = getTopFrame(getCurrentThread()).location;
locations.push([line, column]);
info(`Break on ${line}:${column}`);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay.js b/devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay.js
index 1d442c5ca5..93b537bba5 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay.js
@@ -71,3 +71,39 @@ add_task(async function () {
});
ok(true, "The overlay is hidden after clicking on the resume button");
});
+
+add_task(async function testOverlayDisabled() {
+ await pushPref("devtools.debugger.features.overlay", false);
+
+ const dbg = await initDebugger("doc-scripts.html");
+ const highlighterTestFront = await getHighlighterTestFront(dbg.toolbox);
+
+ info("Create an eval script that pauses itself.");
+ invokeInTab("doEval");
+
+ await waitForPaused(dbg);
+
+ // Let a chance to regress and still show the overlay
+ await wait(500);
+
+ const isPausedOverlayVisible =
+ await highlighterTestFront.isPausedDebuggerOverlayVisible();
+ ok(
+ !isPausedOverlayVisible,
+ "The paused overlay wasn't shown when the related feature preference is false"
+ );
+
+ const onPreferenceApplied = dbg.toolbox.once("new-configuration-applied");
+ await pushPref("devtools.debugger.features.overlay", true);
+ await onPreferenceApplied;
+
+ info("Click debugger UI step-in button");
+ const stepButton = await waitFor(() => findElement(dbg, "stepIn"));
+ stepButton.click();
+
+ await waitFor(() => highlighterTestFront.isPausedDebuggerOverlayVisible());
+ ok(
+ true,
+ "Stepping after having toggled the feature preference back to true allow the overlay to be shown again"
+ );
+});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused.js b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused.js
index a5b9260af2..43bb6279fd 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-paused.js
@@ -21,7 +21,7 @@ add_task(async function () {
await waitForSelectedSource(dbg, "math.min.js:formatted");
await waitForState(
dbg,
- state => dbg.selectors.getSelectedFrame(thread).location.line == 18
+ () => dbg.selectors.getSelectedFrame(thread).location.line == 18
);
assertPausedAtSourceAndLine(
dbg,
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js b/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
index 4075b6525a..b58dd19686 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
@@ -60,7 +60,7 @@ add_task(async function () {
function waitForSelectedFrame(dbg, displayName) {
const { getInScopeLines, getVisibleSelectedFrame } = dbg.selectors;
- return waitForState(dbg, state => {
+ return waitForState(dbg, () => {
const frame = getVisibleSelectedFrame();
return frame?.displayName == displayName && getInScopeLines(frame.location);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-react-app.js b/devtools/client/debugger/test/mochitest/browser_dbg-react-app.js
index 2882bba1b6..f2f304805e 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-react-app.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-react-app.js
@@ -15,7 +15,7 @@ add_task(async function () {
invokeInTab("clickButton");
await waitForPaused(dbg);
- await waitForState(dbg, state =>
+ await waitForState(dbg, () =>
dbg.selectors.getSelectedScopeMappings(dbg.selectors.getCurrentThread())
);
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js b/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
index 75daa9a469..57238dc36c 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
@@ -125,7 +125,7 @@ add_task(async function () {
is(dbg.win.document.activeElement.tagName, "INPUT", "Search field focused");
});
-async function navigateWithKey(dbg, key, expectedLine, assertionMessage) {
+async function navigateWithKey(dbg, key, expectedLine) {
pressKey(dbg, key);
await waitForCursorPosition(dbg, expectedLine);
}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-slow-script.js b/devtools/client/debugger/test/mochitest/browser_dbg-slow-script.js
index 83b35e1009..39008a7478 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-slow-script.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-slow-script.js
@@ -7,6 +7,11 @@
// Tests the slow script warning
add_task(async function openDebuggerFirst() {
+ // This test fails with pending vsync at end of test without fission, not EFT
+ if (!isFissionEnabled() && !isEveryFrameTargetEnabled()) {
+ return;
+ }
+
// In mochitest, the timeout is disable, so set it to a short, but non zero duration
await pushPref("dom.max_script_run_time", 1);
// Prevents having to click on the page to have the dialog to appear
@@ -41,6 +46,11 @@ add_task(async function openDebuggerFirst() {
});
add_task(async function openDebuggerFromDialog() {
+ // This test fails with pending vsync at end of test without fission, not EFT
+ if (!isFissionEnabled() && !isEveryFrameTargetEnabled()) {
+ return;
+ }
+
const tab = await addTab(EXAMPLE_URL + "doc-slow-script.html");
const alert = BrowserTestUtils.waitForGlobalNotificationBar(
@@ -57,7 +67,7 @@ add_task(async function openDebuggerFromDialog() {
// And mochitest may consider this as an error. So ignore any rejection.
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
content.wrappedJSObject.infiniteLoop();
- }).catch(e => {});
+ }).catch(() => {});
info("Wait for the slow script warning");
const notification = await alert;
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-bogus.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-bogus.js
index e9e3a3c7f2..79a8245613 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-bogus.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-bogus.js
@@ -53,6 +53,16 @@ add_task(async function () {
"There is a warning about the missing source map file"
);
+ let footerButton = findElement(dbg, "sourceMapFooterButton");
+ ok(
+ footerButton.classList.contains("not-mapped"),
+ "The source map error causes the file to be reported as not mapped"
+ );
+ ok(
+ footerButton.classList.contains("error"),
+ "The source map error is displayed in the source map icon"
+ );
+
// Test a Source Map with missing original text content
await selectSource(dbg, "map-with-failed-original-request.js");
ok(
@@ -87,5 +97,24 @@ add_task(async function () {
`Error while fetching an original source: request failed with status 404\nSource URL: ${EXAMPLE_URL}map-with-failed-original-request.original.js`
);
+ footerButton = findElement(dbg, "sourceMapFooterButton");
+ is(
+ footerButton.textContent,
+ "original file",
+ "Even if the original can't be loaded, it is reported as original in the footer"
+ );
+ ok(
+ !footerButton.classList.contains("loading"),
+ "The source map isn't loading because of the missing text content"
+ );
+ ok(
+ !footerButton.classList.contains("error"),
+ "The source map isn't reported with an error because of the missing text content"
+ );
+ ok(
+ footerButton.classList.contains("original"),
+ "The source map icon is set to original"
+ );
+
await resume(dbg);
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
index 93440dc9e1..4348e2103d 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
@@ -17,7 +17,34 @@ add_task(async function () {
info("Pretty print the bundle");
await selectSource(dbg, bundleSrc);
+
+ const footerButton = findElement(dbg, "sourceMapFooterButton");
+ is(
+ footerButton.textContent,
+ "Source Maps disabled",
+ "The source map button reports the disabling"
+ );
+ ok(
+ footerButton.classList.contains("disabled"),
+ "The source map button is disabled"
+ );
+
clickElement(dbg, "prettyPrintButton");
await waitForSelectedSource(dbg, "bundle.js:formatted");
- ok(true, "everything finished");
+ ok(true, "Pretty printed source shown");
+
+ const toggled = waitForDispatch(dbg.store, "TOGGLE_SOURCE_MAPS_ENABLED");
+ await clickOnSourceMapMenuItem(dbg, ".debugger-source-map-enabled");
+ await toggled;
+ ok(true, "Toggled the Source map setting");
+
+ is(
+ footerButton.textContent,
+ "original file",
+ "The source map button now reports the pretty printed file as original file"
+ );
+ ok(
+ !footerButton.classList.contains("disabled"),
+ "The source map button is no longer disabled"
+ );
});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
index c10273baaf..5814e423f2 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
@@ -54,8 +54,5 @@ add_task(async function () {
});
async function waitForBreakpointCount(dbg, count) {
- return waitForState(
- dbg,
- state => dbg.selectors.getBreakpointCount() === count
- );
+ return waitForState(dbg, () => dbg.selectors.getBreakpointCount() === count);
}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
index 7ed70b3310..d7c71aade8 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
@@ -98,6 +98,25 @@ add_task(async function () {
"Pending selected location is the expected one"
);
+ const footerButton = findElement(dbg, "sourceMapFooterButton");
+ is(
+ footerButton.textContent,
+ "original file",
+ "The source map button's label mention an original file"
+ );
+ ok(
+ footerButton.classList.contains("original"),
+ "The source map icon is original"
+ );
+ ok(
+ !footerButton.classList.contains("not-mapped"),
+ "The source map button isn't gray out"
+ );
+ ok(
+ !footerButton.classList.contains("loading"),
+ "The source map button isn't reporting in-process loading"
+ );
+
info("Click on jump to generated source link from editor's footer");
let mappedSourceLink = findElement(dbg, "mappedSourceLink");
is(
@@ -117,6 +136,23 @@ add_task(async function () {
"From entry.js",
"The link to mapped source mentions the original source"
);
+ is(
+ footerButton.textContent,
+ "bundle file",
+ "When moved to the bundle, the source map button's label mention a bundle file"
+ );
+ ok(
+ !footerButton.classList.contains("original"),
+ "The source map icon isn't original"
+ );
+ ok(
+ !footerButton.classList.contains("not-mapped"),
+ "The source map button isn't gray out"
+ );
+ ok(
+ !footerButton.classList.contains("loading"),
+ "The source map button isn't reporting in-process loading"
+ );
info("Move the cursor within the bundle to another original source");
getCM(dbg).setCursor({ line: 70, ch: 0 });
@@ -126,6 +162,18 @@ add_task(async function () {
"From times2.js",
"The link to mapped source updates to the newly selected original source within the bundle"
);
+
+ info("Move to the new original file via the source map button/menu");
+ await clickOnSourceMapMenuItem(dbg, ".debugger-jump-mapped-source");
+ await waitForSelectedSource(dbg, "times2.js");
+
+ info("Open the related source map file and wait for a new tab to be opened");
+ const onTabLoaded = BrowserTestUtils.waitForNewTab(
+ gBrowser,
+ `view-source:${EXAMPLE_URL}sourcemaps/bundle.js.map`
+ );
+ await clickOnSourceMapMenuItem(dbg, ".debugger-source-map-link");
+ await onTabLoaded;
});
function assertBreakpointExists(dbg, source, line) {
@@ -143,5 +191,5 @@ async function waitForBreakpointCount(dbg, count) {
const {
selectors: { getBreakpointCount },
} = dbg;
- await waitForState(dbg, state => getBreakpointCount() == count);
+ await waitForState(dbg, () => getBreakpointCount() == count);
}
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-ua-widgets.js b/devtools/client/debugger/test/mochitest/browser_dbg-ua-widgets.js
index e563d52824..07d628c45a 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-ua-widgets.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-ua-widgets.js
@@ -28,7 +28,7 @@ add_task(async function () {
);
clickElement(dbg, "pause");
- await waitForState(dbg, state =>
+ await waitForState(dbg, () =>
dbg.selectors.getIsWaitingOnBreak(dbg.selectors.getCurrentThread())
);
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 a38aebe6e0..f2e20f4541 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
@@ -168,7 +168,7 @@ add_task(async function () {
await removeTab(gBrowser.selectedTab);
});
-async function checkWorkerStatus(dbg, status) {
+async function checkWorkerStatus(_dbg, _status) {
/* TODO: Re-Add support for showing service worker status (Bug 1641099)
await waitUntil(() => {
const threads = dbg.selectors.getThreads();
diff --git a/devtools/client/debugger/test/mochitest/browser_kz.toml b/devtools/client/debugger/test/mochitest/browser_kz.toml
index 5af2243d7f..6b39a42b94 100644
--- a/devtools/client/debugger/test/mochitest/browser_kz.toml
+++ b/devtools/client/debugger/test/mochitest/browser_kz.toml
@@ -73,17 +73,14 @@ skip-if = [
]
["browser_dbg-outline-filter.js"]
-fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
["browser_dbg-outline-focus.js"]
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
skip-if = ["verify"]
["browser_dbg-outline-pretty.js"]
-fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
["browser_dbg-outline.js"]
-fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
["browser_dbg-overrides.js"]
fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and/or labeled
diff --git a/devtools/client/debugger/test/mochitest/shared-head.js b/devtools/client/debugger/test/mochitest/shared-head.js
index 2466957044..b2a1c7c3d7 100644
--- a/devtools/client/debugger/test/mochitest/shared-head.js
+++ b/devtools/client/debugger/test/mochitest/shared-head.js
@@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+// This file is loaded in a `spawn` context sometimes which doesn't have,
+// `Assert`, so we can't use its comparison functions.
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
/**
* Helper methods to drive with the debugger during mochitests. This file can be safely
* required from other panel test files.
@@ -50,8 +54,8 @@ const {
} = require("devtools/client/debugger/src/utils/prefs");
const {
- safeDecodeItemName,
-} = require("devtools/client/debugger/src/utils/sources-tree/utils");
+ getUnicodeUrlPath,
+} = require("resource://devtools/client/shared/unicode-url.js");
const {
isGeneratedId,
@@ -133,7 +137,7 @@ async function waitForSources(dbg, ...sources) {
function waitForSource(dbg, url) {
return waitForState(
dbg,
- state => findSource(dbg, url, { silent: true }),
+ () => findSource(dbg, url, { silent: true }),
"source exists"
);
}
@@ -185,7 +189,7 @@ function assertClass(el, className, exists = true) {
}
function waitForSelectedLocation(dbg, line, column) {
- return waitForState(dbg, state => {
+ return waitForState(dbg, () => {
const location = dbg.selectors.getSelectedLocation();
return (
location &&
@@ -216,7 +220,7 @@ function waitForSelectedSource(dbg, sourceOrUrl) {
return waitForState(
dbg,
- state => {
+ () => {
const location = dbg.selectors.getSelectedLocation() || {};
const sourceTextContent = getSelectedSourceTextContent();
if (!sourceTextContent) {
@@ -504,10 +508,7 @@ async function waitForLoadedScopes(dbg) {
}
function waitForBreakpointCount(dbg, count) {
- return waitForState(
- dbg,
- state => dbg.selectors.getBreakpointCount() == count
- );
+ return waitForState(dbg, () => dbg.selectors.getBreakpointCount() == count);
}
function waitForBreakpoint(dbg, url, line) {
@@ -569,7 +570,7 @@ async function waitForPaused(
await waitForState(
dbg,
- state => isPaused(dbg) && !!getSelectedScope(getCurrentThread()),
+ () => isPaused(dbg) && !!getSelectedScope(getCurrentThread()),
"paused"
);
@@ -588,7 +589,7 @@ async function waitForPaused(
*/
function waitForResumed(dbg) {
info("Waiting for the debugger to resume");
- return waitForState(dbg, state => !dbg.selectors.getIsCurrentThreadPaused());
+ return waitForState(dbg, () => !dbg.selectors.getIsCurrentThreadPaused());
}
function waitForInlinePreviews(dbg) {
@@ -596,7 +597,7 @@ function waitForInlinePreviews(dbg) {
}
function waitForCondition(dbg, condition) {
- return waitForState(dbg, state =>
+ return waitForState(dbg, () =>
dbg.selectors
.getBreakpointsList()
.find(bp => bp.options.condition == condition)
@@ -604,7 +605,7 @@ function waitForCondition(dbg, condition) {
}
function waitForLog(dbg, logValue) {
- return waitForState(dbg, state =>
+ return waitForState(dbg, () =>
dbg.selectors
.getBreakpointsList()
.find(bp => bp.options.logValue == logValue)
@@ -612,10 +613,10 @@ function waitForLog(dbg, logValue) {
}
async function waitForPausedThread(dbg, thread) {
- return waitForState(dbg, state => dbg.selectors.getIsPaused(thread));
+ return waitForState(dbg, () => dbg.selectors.getIsPaused(thread));
}
-function isSelectedFrameSelected(dbg, state) {
+function isSelectedFrameSelected(dbg) {
const frame = dbg.selectors.getVisibleSelectedFrame();
// Make sure the source text is completely loaded for the
@@ -733,7 +734,7 @@ function findSource(
const source = sources.find(s => {
// Sources don't have a file name attribute, we need to compute it here:
const sourceFileName = s.url
- ? safeDecodeItemName(s.url.substring(s.url.lastIndexOf("/") + 1))
+ ? getUnicodeUrlPath(s.url.substring(s.url.lastIndexOf("/") + 1))
: "";
// The input argument may either be only the filename, or the complete URL
@@ -784,7 +785,7 @@ function sourceExists(dbg, url) {
function waitForLoadedSource(dbg, url) {
return waitForState(
dbg,
- state => {
+ () => {
const source = findSource(dbg, url, { silent: true });
return (
source &&
@@ -1772,6 +1773,7 @@ const selectors = {
prettyPrintButton: ".source-footer .prettyPrint",
mappedSourceLink: ".source-footer .mapped-source",
sourcesFooter: ".sources-panel .source-footer",
+ sourceMapFooterButton: ".debugger-source-map-button",
editorFooter: ".editor-pane .source-footer",
sourceNode: i => `.sources-list .tree-node:nth-child(${i}) .node`,
sourceNodes: ".sources-list .tree-node",
@@ -2202,8 +2204,9 @@ async function clickAtPos(dbg, pos) {
bubbles: true,
cancelable: true,
view: dbg.win,
- clientX: left,
- clientY: top,
+ // Shift by one as we might be on the edge of the element and click on previous line/column
+ clientX: left + 1,
+ clientY: top + 1,
})
);
}
@@ -2570,14 +2573,13 @@ async function assertPreviews(dbg, previews) {
* @param {Number} column
* @param {Object} options
* @param {String} options.result - Expected text shown in the preview
- * @param {String} options.expression - The expression hovered over
* @param {Array} options.fields - The expected stacktrace information
*/
async function assertInlineExceptionPreview(
dbg,
line,
column,
- { expression, result, fields }
+ { result, fields }
) {
info(" # Assert preview on " + line + ":" + column);
const { element: popupEl, tokenEl } = await tryHovering(
@@ -2628,7 +2630,7 @@ async function assertInlineExceptionPreview(
async function waitForBreakableLine(dbg, source, lineNumber) {
await waitForState(
dbg,
- state => {
+ () => {
const currentSource = findSource(dbg, source);
const breakableLines =
@@ -2944,6 +2946,33 @@ async function toggleDebbuggerSettingsMenuItem(dbg, { className, isChecked }) {
await waitFor(() => menuButton.getAttribute("aria-expanded") === "false");
}
+/**
+ * Click on the source map button in the editor's footer
+ * and wait for its context menu to be rendered before clicking
+ * on one menuitem of it.
+ *
+ * @param {Object} dbg
+ * @param {String} className
+ * The class name of the menuitem to click in the context menu.
+ */
+async function clickOnSourceMapMenuItem(dbg, className) {
+ const menuButton = findElement(dbg, "sourceMapFooterButton");
+ const { parent } = dbg.panel.panelWin;
+ const { document } = parent;
+
+ menuButton.click();
+ // Waits for the debugger settings panel to appear.
+ await waitFor(() => {
+ const menuListEl = document.querySelector("#debugger-source-map-list");
+ // Lets check the offsetParent property to make sure the menu list is actually visible
+ // by its parents display property being no longer "none".
+ return menuListEl && menuListEl.offsetParent !== null;
+ });
+
+ const menuItem = document.querySelector(className);
+ menuItem.click();
+}
+
async function setLogPoint(dbg, index, value) {
rightClickElement(dbg, "gutter", index);
await waitForContextMenu(dbg);
@@ -2964,10 +2993,7 @@ async function setLogPoint(dbg, index, value) {
function openProjectSearch(dbg) {
info("Opening the project search panel");
synthesizeKeyShortcut("CmdOrCtrl+Shift+F");
- return waitForState(
- dbg,
- state => dbg.selectors.getActiveSearch() === "project"
- );
+ return waitForState(dbg, () => dbg.selectors.getActiveSearch() === "project");
}
/**
@@ -3076,6 +3102,7 @@ async function selectBlackBoxContextMenuItem(dbg, itemName) {
}
function openOutlinePanel(dbg, waitForOutlineList = true) {
+ info("Select the outline panel");
const outlineTab = findElementWithSelector(dbg, ".outline-tab a");
EventUtils.synthesizeMouseAtCenter(outlineTab, {}, outlineTab.ownerGlobal);
@@ -3105,7 +3132,7 @@ function assertOutlineItems(dbg, expectedItems) {
async function checkAdditionalThreadCount(dbg, count) {
await waitForState(
dbg,
- state => {
+ () => {
return dbg.selectors.getThreads().length == count;
},
"Have the expected number of additional threads"