Bug 1685090 - [devtools] Fix and re-enable browser toolbox test for breakpoints. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D100928
This commit is contained in:
Alexandre Poirot 2021-01-11 13:23:11 +00:00
parent 6bd8a09aee
commit dc000caa3b
3 changed files with 39 additions and 19 deletions

View File

@ -2009,17 +2009,25 @@ async function toggleDebbuggerSettingsMenuItem(dbg, { className, isChecked }) {
await waitFor(() => menuButton.getAttribute("aria-expanded") === "false");
}
// This module is also loaded for Browser Toolbox tests, within the browser toolbox process
// which doesn't contain mochitests resource://testing-common URL.
// This isn't important to allow rejections in the context of the browser toolbox tests.
const protocolHandler = Services.io
.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
if (protocolHandler.hasSubstitution("testing-common")) {
const { PromiseTestUtils } = ChromeUtils.import(
"resource://testing-common/PromiseTestUtils.jsm"
);
const { PromiseTestUtils } = ChromeUtils.import(
"resource://testing-common/PromiseTestUtils.jsm"
);
// Debugger operations that are canceled because they were rendered obsolete by
// a navigation or pause/resume end up as uncaught rejections. These never
// indicate errors and are allowed in all debugger tests.
PromiseTestUtils.allowMatchingRejectionsGlobally(/Page has navigated/);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Current thread has changed/);
PromiseTestUtils.allowMatchingRejectionsGlobally(
/Current thread has paused or resumed/
);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Connection closed/);
// Debugger operations that are canceled because they were rendered obsolete by
// a navigation or pause/resume end up as uncaught rejections. These never
// indicate errors and are allowed in all debugger tests.
PromiseTestUtils.allowMatchingRejectionsGlobally(/Page has navigated/);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Current thread has changed/);
PromiseTestUtils.allowMatchingRejectionsGlobally(
/Current thread has paused or resumed/
);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Connection closed/);
this.PromiseTestUtils = PromiseTestUtils;
}

View File

@ -24,7 +24,6 @@ prefs =
[browser_browser_toolbox.js]
[browser_browser_toolbox_debugger.js]
skip-if = os == 'win' || debug || (bits == 64 && !debug && (os == 'mac' || os == 'linux')) # Bug 1282269, Bug 1448084, Bug 1270731
[browser_browser_toolbox_evaluation_context.js]
[browser_browser_toolbox_fission_contentframe_inspector.js]
[browser_browser_toolbox_fission_inspector.js]

View File

@ -16,10 +16,11 @@ requestLongerTimeout(4);
const { fetch } = require("devtools/shared/DevToolsUtils");
const debuggerHeadURL =
CHROME_URL_ROOT + "../../debugger/test/mochitest/head.js";
const helpersURL = CHROME_URL_ROOT + "../../debugger/test/mochitest/helpers.js";
CHROME_URL_ROOT + "../../../debugger/test/mochitest/head.js";
const helpersURL =
CHROME_URL_ROOT + "../../../debugger/test/mochitest/helpers.js";
const helpersContextURL =
CHROME_URL_ROOT + "../../debugger/test/mochitest/helpers/context.js";
CHROME_URL_ROOT + "../../../debugger/test/mochitest/helpers/context.js";
add_task(async function runTest() {
const s = Cu.Sandbox("http://mozilla.org");
@ -65,11 +66,14 @@ add_task(async function runTest() {
/Services.scriptloader.loadSubScript[^\)]*\);/g,
""
);
const ToolboxTask = await initBrowserToolboxTask();
await ToolboxTask.importScript(debuggerHead);
await ToolboxTask.importFunctions({
// head.js uses this method
registerCleanupFunction: () => {},
waitUntil,
});
await ToolboxTask.importScript(debuggerHead);
await ToolboxTask.spawn(`"${testUrl}"`, async _testUrl => {
/* global createDebuggerContext, waitForSources,
@ -92,7 +96,15 @@ add_task(async function runTest() {
await waitForSources(dbg, _testUrl);
info("Loaded, selecting the test script to debug");
// First expand the domain
// First expand the main thread
const mainThread = [...document.querySelectorAll(".tree-node")].find(
node => {
return node.querySelector(".label").textContent.trim() == "Main Thread";
}
);
mainThread.querySelector(".arrow").click();
// Then expand the domain
const domain = [...document.querySelectorAll(".tree-node")].find(node => {
return node.querySelector(".label").textContent.trim() == "mozilla.org";
});
@ -101,6 +113,7 @@ add_task(async function runTest() {
const fileName = _testUrl.match(/browser-toolbox-test.*\.js/)[0];
// And finally the expected source
let script = [...document.querySelectorAll(".tree-node")].find(node => {
return node.textContent.includes(fileName);
});