From e9bba419631c845792e2a35d36ea2d48d07bc6d9 Mon Sep 17 00:00:00 2001 From: Ponchale Date: Wed, 11 Sep 2024 13:37:44 -0500 Subject: [PATCH] =?UTF-8?q?=20Backed=20out=202=20changesets=20(bug=2019080?= =?UTF-8?q?95)=20for=20causing=20failures=20at=20browser=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …_dbg-features-breakpoints.js. a=backout Backed out changeset 21bf8880f772 (bug 1908095) Backed out changeset 85060db8ce99 (bug 1908095) --- ...er_aboutdebugging_addons_debug_debugger.js | 232 +++++++----------- .../browser_dbg-features-breakable-lines.js | 4 +- ...rowser_dbg-features-breakable-positions.js | 11 +- .../browser_dbg-features-breakpoints.js | 61 +---- .../browser_dbg-features-source-tree.js | 7 +- .../sourcemaps-reload-compressed/package.json | 10 +- .../v1/index.html | 10 - .../v1/log-worker.js | 3 - .../v1/react-component-module.js | 2 - .../sourcemaps-reload-compressed/v1/script.js | 4 +- .../v1/index.html | 7 - .../v1/log-worker.js | 3 - .../client/debugger/test/mochitest/head.js | 1 - .../DevToolsProcessChild.sys.mjs | 45 +--- .../target-watchers/worker.sys.mjs | 20 -- 15 files changed, 105 insertions(+), 315 deletions(-) delete mode 100644 devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/log-worker.js delete mode 100644 devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/react-component-module.js delete mode 100644 devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-uncompressed/v1/log-worker.js diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_debug_debugger.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_debug_debugger.js index 6ad18bce0fc..0f10700b5fd 100644 --- a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_debug_debugger.js +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_debug_debugger.js @@ -1,149 +1,87 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -Services.scriptloader.loadSubScript( - "chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/shared-head.js", - this -); - -/* import-globals-from helper-addons.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); - -const L10N = new LocalizationHelper( - "devtools/client/locales/toolbox.properties" -); - -const EXTENSION_NAME = "temporary-web-extension"; -const EXTENSION_ID = "test-devtools@mozilla.org"; - -add_task(async function testOpenDebuggerReload() { - await enableExtensionDebugging(); - - info( - "The debugger should show the source codes of extension even if " + - "devtools.chrome.enabled and devtools.debugger.remote-enabled are off" - ); - await pushPref("devtools.chrome.enabled", false); - await pushPref("devtools.debugger.remote-enabled", false); - - const { document, tab, window } = await openAboutDebugging(); - await selectThisFirefoxPage(document, window.AboutDebugging.store); - - await installTemporaryExtensionFromXPI( - { - background() { - window.someRandomMethodName = () => { - // This will not be referred from anywhere. - // However this is necessary to show as the source code in the debugger. - }; - }, - id: EXTENSION_ID, - name: EXTENSION_NAME, - }, - document - ); - - // Select the debugger right away to avoid any noise coming from the inspector. - await pushPref("devtools.toolbox.selectedTool", "jsdebugger"); - const { devtoolsWindow } = await openAboutDevtoolsToolbox( - document, - tab, - window, - EXTENSION_NAME - ); - const toolbox = getToolbox(devtoolsWindow); - const { panelWin } = toolbox.getCurrentPanel(); - - info("Check the state of redux"); - ok( - panelWin.dbg.store.getState().sourcesTree.isWebExtension, - "isWebExtension flag in sourcesTree is true" - ); - - info("Check whether the element displays correctly"); - let sourceList = panelWin.document.querySelector(".sources-list"); - ok(sourceList, "Source list element displays correctly"); - ok( - sourceList.textContent.includes("temporary-web-extension"), - "Extension name displays correctly" - ); - - const waitForLoadedPanelsReload = await watchForLoadedPanelsReload(toolbox); - - info("Reload the addon using a toolbox reload shortcut"); - toolbox.win.focus(); - synthesizeKeyShortcut(L10N.getStr("toolbox.reload.key"), toolbox.win); - - await waitForLoadedPanelsReload(); - - info("Wait until a new background log message is logged"); - await waitFor(() => { - // As React may re-create a new sources-list element, - // fetch the latest instance - sourceList = panelWin.document.querySelector(".sources-list"); - return sourceList?.textContent.includes("temporary-web-extension"); - }, "Wait for the source to re-appear"); - - await closeWebExtAboutDevtoolsToolbox(devtoolsWindow, window); - await removeTemporaryExtension(EXTENSION_NAME, document); - await removeTab(tab); -}); - -add_task(async function testAddAndRemoveBreakpoint() { - await enableExtensionDebugging(); - - const { document, tab, window } = await openAboutDebugging(); - await selectThisFirefoxPage(document, window.AboutDebugging.store); - - await installTemporaryExtensionFromXPI( - { - background() { - window.invokeLogFromWebextension = () => { - console.log("From webextension"); - }; - }, - id: EXTENSION_ID, - name: EXTENSION_NAME, - }, - document - ); - - // Select the debugger right away to avoid any noise coming from the inspector. - await pushPref("devtools.toolbox.selectedTool", "jsdebugger"); - const { devtoolsWindow } = await openAboutDevtoolsToolbox( - document, - tab, - window, - EXTENSION_NAME - ); - const toolbox = getToolbox(devtoolsWindow); - const dbg = createDebuggerContext(toolbox); - - info("Select the source and add a breakpoint"); - // Note: the background script filename is dynamically generated id, so we - // simply get the first source from the list. - const displayedSources = dbg.selectors.getDisplayedSourcesList(); - const backgroundScript = displayedSources[0]; - await selectSource(dbg, backgroundScript); - await addBreakpoint(dbg, backgroundScript, 3); - - info("Trigger the breakpoint and wait for the debugger to pause"); - const webconsole = await toolbox.selectTool("webconsole"); - const { hud } = webconsole; - hud.ui.wrapper.dispatchEvaluateExpression("invokeLogFromWebextension()"); - await waitForPaused(dbg); - - info("Resume and remove the breakpoint"); - await resume(dbg); - await removeBreakpoint(dbg, backgroundScript.id, 3); - - info("Trigger the function again and check the debugger does not pause"); - hud.ui.wrapper.dispatchEvaluateExpression("invokeLogFromWebextension()"); - await wait(500); - assertNotPaused(dbg); - - await closeWebExtAboutDevtoolsToolbox(devtoolsWindow, window); - await removeTemporaryExtension(EXTENSION_NAME, document); - await removeTab(tab); -}); + "use strict"; + + /* import-globals-from helper-addons.js */ + Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); + + const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" + ); + + add_task(async () => { + const EXTENSION_NAME = "temporary-web-extension"; + const EXTENSION_ID = "test-devtools@mozilla.org"; + + await enableExtensionDebugging(); + + info( + "The debugger should show the source codes of extension even if " + + "devtools.chrome.enabled and devtools.debugger.remote-enabled are off" + ); + await pushPref("devtools.chrome.enabled", false); + await pushPref("devtools.debugger.remote-enabled", false); + + const { document, tab, window } = await openAboutDebugging(); + await selectThisFirefoxPage(document, window.AboutDebugging.store); + + await installTemporaryExtensionFromXPI( + { + background() { + window.someRandomMethodName = () => { + // This will not be referred from anywhere. + // However this is necessary to show as the source code in the debugger. + }; + }, + id: EXTENSION_ID, + name: EXTENSION_NAME, + }, + document + ); + + // Select the debugger right away to avoid any noise coming from the inspector. + await pushPref("devtools.toolbox.selectedTool", "jsdebugger"); + const { devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + EXTENSION_NAME + ); + const toolbox = getToolbox(devtoolsWindow); + const { panelWin } = toolbox.getCurrentPanel(); + + info("Check the state of redux"); + ok( + panelWin.dbg.store.getState().sourcesTree.isWebExtension, + "isWebExtension flag in sourcesTree is true" + ); + + info("Check whether the element displays correctly"); + let sourceList = panelWin.document.querySelector(".sources-list"); + ok(sourceList, "Source list element displays correctly"); + ok( + sourceList.textContent.includes("temporary-web-extension"), + "Extension name displays correctly" + ); + + const waitForLoadedPanelsReload = await watchForLoadedPanelsReload(toolbox); + + info("Reload the addon using a toolbox reload shortcut"); + toolbox.win.focus(); + synthesizeKeyShortcut(L10N.getStr("toolbox.reload.key"), toolbox.win); + + await waitForLoadedPanelsReload(); + + info("Wait until a new background log message is logged"); + await waitFor(() => { + // As React may re-create a new sources-list element, + // fetch the latest instance + sourceList = panelWin.document.querySelector(".sources-list"); + return sourceList?.textContent.includes("temporary-web-extension"); + }, "Wait for the source to re-appear"); + + await closeWebExtAboutDevtoolsToolbox(devtoolsWindow, window); + await removeTemporaryExtension(EXTENSION_NAME, document); + await removeTab(tab); + }); + \ No newline at end of file diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-lines.js b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-lines.js index b197126ed8e..872530025fc 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-lines.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-lines.js @@ -19,14 +19,12 @@ add_task(async function testBreakableLinesOverReloads() { ); info("Assert breakable lines of the first html page load"); - await assertBreakableLines(dbg, "index.html", 85, [ + await assertBreakableLines(dbg, "index.html", 78, [ ...getRange(16, 17), 21, ...getRange(24, 25), 30, 36, - 39, - ...getRange(41, 43), ]); info("Assert breakable lines of the first original source file, original.js"); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-positions.js b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-positions.js index 994199c12eb..8921b83f2bc 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-positions.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakable-positions.js @@ -30,7 +30,7 @@ add_task(async function testBreakableLinesOverReloads() { ); info("Assert breakable lines of the first html page load"); - await assertBreakablePositions(dbg, "index.html", 85, [ + await assertBreakablePositions(dbg, "index.html", 78, [ { line: 16, columns: [6, 14] }, { line: 17, columns: [] }, { line: 21, columns: [12, 20, 48] }, @@ -38,23 +38,16 @@ add_task(async function testBreakableLinesOverReloads() { { line: 25, columns: [] }, { line: 30, columns: [] }, { line: 36, columns: [] }, - { line: 39, columns: [] }, - { line: 41, columns: [8, 18] }, - { line: 42, columns: [] }, - { line: 43, columns: [] }, ]); info("Pretty print first html page load and assert breakable lines"); await prettyPrint(dbg); - await assertBreakablePositions(dbg, "index.html:formatted", 96, [ + await assertBreakablePositions(dbg, "index.html:formatted", 87, [ { line: 16, columns: [0, 8] }, { line: 22, columns: [0, 8, 35] }, { line: 27, columns: [0, 8] }, { line: 28, columns: [] }, { line: 36, columns: [] }, - { line: 48, columns: [] }, - { line: 50, columns: [2, 12] }, - { line: 53, columns: [] }, ]); await closeTab(dbg, "index.html:formatted"); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakpoints.js b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakpoints.js index 107e3a9ef8f..51728f628ea 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-features-breakpoints.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-features-breakpoints.js @@ -70,63 +70,4 @@ add_task( await dbg.actions.stepIn(); await assertNotPaused(dbg); } -); - -/** - * Tests that the source tree works with all the various types of sources - * coming from the integration test page. - * - * Also assert a few extra things on sources with query strings: - * - they can be pretty printed, - * - quick open matches them, - * - you can set breakpoint on them. - */ -add_task(async function testSourceTreeOnTheIntegrationTestPage() { - const dbg = await initDebuggerWithAbsoluteURL("about:blank"); - - await navigateToAbsoluteURL( - dbg, - TEST_URL, - "index.html", - "script.js", - "log-worker.js" - ); - - info("Select the source and add a breakpoint"); - await selectSource(dbg, "script.js"); - await addBreakpoint(dbg, "script.js", 7); - - info("Trigger the breakpoint and wait for the debugger to pause"); - invokeInTab("nonSourceMappedFunction"); - await waitForPaused(dbg); - - info("Resume and remove the breakpoint"); - await resume(dbg); - await removeBreakpoint(dbg, findSource(dbg, "script.js").id, 7); - - info("Trigger the function again and check the debugger does not pause"); - invokeInTab("nonSourceMappedFunction"); - await wait(500); - assertNotPaused(dbg); - - info("[worker] Select the source and add a breakpoint"); - await selectSource(dbg, "log-worker.js"); - await addBreakpoint(dbg, "log-worker.js", 2); - - info("[worker] Trigger the breakpoint and wait for the debugger to pause"); - invokeInTab("invokeLogWorker"); - await waitForPaused(dbg); - - info("[worker] Resume and remove the breakpoint"); - await resume(dbg); - await removeBreakpoint(dbg, findSource(dbg, "log-worker.js").id, 2); - - info( - "[worker] Trigger the function again and check the debugger does not pause" - ); - invokeInTab("invokeLogWorker"); - await wait(500); - assertNotPaused(dbg); - - dbg.toolbox.closeToolbox(); -}); +); \ No newline at end of file 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 415fa011ff2..121e4a0284d 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 @@ -320,12 +320,11 @@ add_task(async function testSourceTreeOnTheIntegrationTestPage() { .getAllThreads() .find(thread => thread.name == "Main Thread"); - // When EFT is disabled the iframe's source is meld into the main target. - const expectedSameUrlSources = isEveryFrameTargetEnabled() ? 3 : 4; is( sourceActors.filter(actor => actor.thread == mainThread.actor).length, - expectedSameUrlSources, - `same-url.js is loaded ${expectedSameUrlSources} times in the main thread` + // When EFT is disabled the iframe's source is meld into the main target + isEveryFrameTargetEnabled() ? 3 : 4, + "same-url.js is loaded 3 times in the main thread" ); if (isEveryFrameTargetEnabled()) { diff --git a/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/package.json b/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/package.json index f0d68f6cc4d..30187c5de40 100644 --- a/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/package.json +++ b/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/package.json @@ -11,10 +11,10 @@ "license": "MPL-2.0", "dependencies": {}, "devDependencies": { - "@babel/core": "7.25.2", - "babel-loader": "7.1.2", - "babel-preset-es2015": "6.24.1", - "webpack": "4.47.0", - "webpack-cli": "4.10.0" + "babel-core": "^7.0.0-beta.3", + "babel-loader": "^7.1.2", + "babel-preset-es2015": "^6.24.1", + "webpack": "^4", + "webpack-cli": "" } } diff --git a/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/index.html b/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/index.html index fea692d57e4..7fa9f4d3064 100644 --- a/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/index.html +++ b/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/index.html @@ -35,13 +35,6 @@ `); - - - - -