diff options
Diffstat (limited to 'devtools/client/aboutdebugging')
24 files changed, 58 insertions, 41 deletions
diff --git a/devtools/client/aboutdebugging/src/actions/debug-targets.js b/devtools/client/aboutdebugging/src/actions/debug-targets.js index 9ac3bee3b5..fa768c3d22 100644 --- a/devtools/client/aboutdebugging/src/actions/debug-targets.js +++ b/devtools/client/aboutdebugging/src/actions/debug-targets.js @@ -7,7 +7,7 @@ const { AddonManager } = ChromeUtils.importESModule( "resource://gre/modules/AddonManager.sys.mjs", // AddonManager is a singleton, never create two instances of it. - { loadInDevToolsLoader: false } + { global: "shared" } ); const { remoteClientManager, @@ -133,7 +133,7 @@ function installTemporaryExtension() { const message = l10n.getString( "about-debugging-tmp-extension-install-message" ); - return async ({ dispatch, getState }) => { + return async ({ dispatch }) => { dispatch({ type: TEMPORARY_EXTENSION_INSTALL_START }); const file = await openTemporaryExtension(window, message); try { @@ -146,7 +146,7 @@ function installTemporaryExtension() { } function pushServiceWorker(id, registrationFront) { - return async ({ dispatch, getState }) => { + return async () => { try { // The push button is only available if canDebugServiceWorkers is true. // With this configuration, `push` should always be called on the diff --git a/devtools/client/aboutdebugging/src/actions/runtimes.js b/devtools/client/aboutdebugging/src/actions/runtimes.js index fba620951e..52148f80b2 100644 --- a/devtools/client/aboutdebugging/src/actions/runtimes.js +++ b/devtools/client/aboutdebugging/src/actions/runtimes.js @@ -202,7 +202,7 @@ function connectRuntime(id) { } function createThisFirefoxRuntime() { - return ({ dispatch, getState }) => { + return ({ dispatch }) => { const thisFirefoxRuntime = { id: RUNTIMES.THIS_FIREFOX, isConnecting: false, @@ -488,7 +488,7 @@ function updateRemoteRuntimes(runtimes, type) { * before leaving about:debugging. */ function removeRuntimeListeners() { - return ({ dispatch, getState }) => { + return ({ getState }) => { const allRuntimes = getAllRuntimes(getState().runtimes); const remoteRuntimes = allRuntimes.filter( r => r.type !== RUNTIMES.THIS_FIREFOX diff --git a/devtools/client/aboutdebugging/src/actions/telemetry.js b/devtools/client/aboutdebugging/src/actions/telemetry.js index b418c77a50..d90b5f49e1 100644 --- a/devtools/client/aboutdebugging/src/actions/telemetry.js +++ b/devtools/client/aboutdebugging/src/actions/telemetry.js @@ -13,7 +13,7 @@ const { * be processed by the event recording middleware. */ function recordTelemetryEvent(method, details) { - return ({ dispatch, getState }) => { + return ({ dispatch }) => { dispatch({ type: TELEMETRY_RECORD, method, details }); }; } diff --git a/devtools/client/aboutdebugging/src/actions/ui.js b/devtools/client/aboutdebugging/src/actions/ui.js index fb676cefd6..f8afac8bbd 100644 --- a/devtools/client/aboutdebugging/src/actions/ui.js +++ b/devtools/client/aboutdebugging/src/actions/ui.js @@ -97,13 +97,13 @@ function updateDebugTargetCollapsibility(key, isCollapsed) { } function addNetworkLocation(location) { - return ({ dispatch, getState }) => { + return () => { NetworkLocationsModule.addNetworkLocation(location); }; } function removeNetworkLocation(location) { - return ({ dispatch, getState }) => { + return () => { NetworkLocationsModule.removeNetworkLocation(location); }; } @@ -133,7 +133,7 @@ function updateAdbReady(isAdbReady) { } function updateNetworkLocations(locations) { - return async ({ dispatch, getState }) => { + return async ({ dispatch }) => { dispatch({ type: NETWORK_LOCATIONS_UPDATE_START }); try { await dispatch(Actions.updateNetworkRuntimes(locations)); @@ -145,7 +145,7 @@ function updateNetworkLocations(locations) { } function installAdbAddon() { - return async ({ dispatch, getState }) => { + return async ({ dispatch }) => { dispatch({ type: ADB_ADDON_INSTALL_START }); try { @@ -160,7 +160,7 @@ function installAdbAddon() { } function uninstallAdbAddon() { - return async ({ dispatch, getState }) => { + return async ({ dispatch }) => { dispatch({ type: ADB_ADDON_UNINSTALL_START }); try { diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/DebugTargetPane.js b/devtools/client/aboutdebugging/src/components/debugtarget/DebugTargetPane.js index abfa1042b8..dec9cd792d 100644 --- a/devtools/client/aboutdebugging/src/components/debugtarget/DebugTargetPane.js +++ b/devtools/client/aboutdebugging/src/components/debugtarget/DebugTargetPane.js @@ -106,7 +106,7 @@ class DebugTargetPane extends PureComponent { "undecorated-link debug-target-pane__title " + "qa-debug-target-pane-title", title, - onClick: e => this.toggleCollapsibility(), + onClick: () => this.toggleCollapsibility(), }, dom.h2( { className: "main-subheading debug-target-pane__heading" }, diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/InspectAction.js b/devtools/client/aboutdebugging/src/components/debugtarget/InspectAction.js index f7aff438a4..13370ecdf3 100644 --- a/devtools/client/aboutdebugging/src/components/debugtarget/InspectAction.js +++ b/devtools/client/aboutdebugging/src/components/debugtarget/InspectAction.js @@ -44,7 +44,7 @@ class InspectAction extends PureComponent { }, dom.button( { - onClick: e => this.inspect(), + onClick: () => this.inspect(), className: "default-button qa-debug-target-inspect-button", disabled, title, diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/ServiceWorkerAdditionalActions.js b/devtools/client/aboutdebugging/src/components/debugtarget/ServiceWorkerAdditionalActions.js index 38262ad511..aed0719d1f 100644 --- a/devtools/client/aboutdebugging/src/components/debugtarget/ServiceWorkerAdditionalActions.js +++ b/devtools/client/aboutdebugging/src/components/debugtarget/ServiceWorkerAdditionalActions.js @@ -48,7 +48,7 @@ class _ActionButton extends PureComponent { { className, disabled, - onClick: e => onClick(), + onClick: () => onClick(), title: disabled && disabledTitle ? disabledTitle : undefined, }, this.props.children @@ -102,7 +102,7 @@ class ServiceWorkerAdditionalActions extends PureComponent { { className, disabled, - onClick: e => onClick(), + onClick: () => onClick(), }, labelId ) diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionAdditionalActions.js b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionAdditionalActions.js index 44b7d3e167..806ddb6ac9 100644 --- a/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionAdditionalActions.js +++ b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionAdditionalActions.js @@ -125,7 +125,7 @@ class TemporaryExtensionAdditionalActions extends PureComponent { className: "default-button default-button--micro " + "qa-temporary-extension-terminate-bgscript-button", - onClick: e => this.terminateBackgroundScript(), + onClick: () => this.terminateBackgroundScript(), }, "Terminate Background Script" ) @@ -142,7 +142,7 @@ class TemporaryExtensionAdditionalActions extends PureComponent { className: "default-button default-button--micro " + "qa-temporary-extension-remove-button", - onClick: e => this.remove(), + onClick: () => this.remove(), }, "Remove" ) @@ -166,7 +166,7 @@ class TemporaryExtensionAdditionalActions extends PureComponent { className: "default-button default-button--micro " + "qa-temporary-extension-reload-button", - onClick: e => this.reload(), + onClick: () => this.reload(), }, "Reload" ) diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstaller.js b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstaller.js index e515c647ec..fe229d2da6 100644 --- a/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstaller.js +++ b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstaller.js @@ -41,7 +41,7 @@ class TemporaryExtensionInstaller extends PureComponent { dom.button( { className: `${className} default-button qa-temporary-extension-install-button`, - onClick: e => this.install(), + onClick: () => this.install(), }, "Load Temporary Add-on…" ) diff --git a/devtools/client/aboutdebugging/src/middleware/extension-component-data.js b/devtools/client/aboutdebugging/src/middleware/extension-component-data.js index 5987f36398..53e6fd22f1 100644 --- a/devtools/client/aboutdebugging/src/middleware/extension-component-data.js +++ b/devtools/client/aboutdebugging/src/middleware/extension-component-data.js @@ -18,7 +18,7 @@ const { * This middleware converts extensions object that get from DevToolsClient.listAddons() * to data which is used in DebugTargetItem. */ -const extensionComponentDataMiddleware = store => next => action => { +const extensionComponentDataMiddleware = () => next => action => { switch (action.type) { case REQUEST_EXTENSIONS_SUCCESS: { action.installedExtensions = toComponentData(action.installedExtensions); diff --git a/devtools/client/aboutdebugging/src/middleware/process-component-data.js b/devtools/client/aboutdebugging/src/middleware/process-component-data.js index d5cdc6365b..c4947453a0 100644 --- a/devtools/client/aboutdebugging/src/middleware/process-component-data.js +++ b/devtools/client/aboutdebugging/src/middleware/process-component-data.js @@ -17,7 +17,7 @@ const { * This middleware converts tabs object that get from DevToolsClient.listProcesses() to * data which is used in DebugTargetItem. */ -const processComponentDataMiddleware = store => next => action => { +const processComponentDataMiddleware = () => next => action => { switch (action.type) { case REQUEST_PROCESSES_SUCCESS: { const mainProcessComponentData = toMainProcessComponentData( @@ -31,7 +31,7 @@ const processComponentDataMiddleware = store => next => action => { return next(action); }; -function toMainProcessComponentData(process) { +function toMainProcessComponentData() { const type = DEBUG_TARGETS.PROCESS; const icon = "chrome://devtools/skin/images/aboutdebugging-process-icon.svg"; diff --git a/devtools/client/aboutdebugging/src/middleware/tab-component-data.js b/devtools/client/aboutdebugging/src/middleware/tab-component-data.js index f468926f81..2de8dca86f 100644 --- a/devtools/client/aboutdebugging/src/middleware/tab-component-data.js +++ b/devtools/client/aboutdebugging/src/middleware/tab-component-data.js @@ -13,7 +13,7 @@ const { * This middleware converts tabs object that get from DevToolsClient.listTabs() to data * which is used in DebugTargetItem. */ -const tabComponentDataMiddleware = store => next => action => { +const tabComponentDataMiddleware = () => next => action => { switch (action.type) { case REQUEST_TABS_SUCCESS: { action.tabs = toComponentData(action.tabs); diff --git a/devtools/client/aboutdebugging/src/middleware/worker-component-data.js b/devtools/client/aboutdebugging/src/middleware/worker-component-data.js index 178c99e322..cf13eccd5d 100644 --- a/devtools/client/aboutdebugging/src/middleware/worker-component-data.js +++ b/devtools/client/aboutdebugging/src/middleware/worker-component-data.js @@ -15,7 +15,7 @@ const { * This middleware converts workers object that get from DevToolsClient.listAllWorkers() * to data which is used in DebugTargetItem. */ -const workerComponentDataMiddleware = store => next => action => { +const workerComponentDataMiddleware = () => next => action => { switch (action.type) { case REQUEST_WORKERS_SUCCESS: { action.otherWorkers = toComponentData(action.otherWorkers); diff --git a/devtools/client/aboutdebugging/src/modules/extensions-helper.js b/devtools/client/aboutdebugging/src/modules/extensions-helper.js index ec0d7c2661..cf6c7641e9 100644 --- a/devtools/client/aboutdebugging/src/modules/extensions-helper.js +++ b/devtools/client/aboutdebugging/src/modules/extensions-helper.js @@ -51,7 +51,7 @@ exports.getExtensionUuid = function (extension) { exports.openTemporaryExtension = function (win, message) { return new Promise(resolve => { const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); - fp.init(win, message, Ci.nsIFilePicker.modeOpen); + fp.init(win.browsingContext, message, Ci.nsIFilePicker.modeOpen); // Try to set the last directory used as "displayDirectory". try { diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_temporary_install_path.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_temporary_install_path.js index a6f9fde0c1..da2596ef53 100644 --- a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_temporary_install_path.js +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_temporary_install_path.js @@ -45,7 +45,7 @@ add_task(async function testPreferenceRetrievedWhenInstallingExtension() { await selectThisFirefoxPage(document, window.AboutDebugging.store); const MockFilePicker = SpecialPowers.MockFilePicker; - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); const onFilePickerShown = new Promise(resolve => { MockFilePicker.showCallback = fp => { resolve(fp); diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_serviceworker_console.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_serviceworker_console.js index 742791668d..4fd0b727d6 100644 --- a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_serviceworker_console.js +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_serviceworker_console.js @@ -85,7 +85,7 @@ add_task(async function () { info("Wait for next interupt in the worker thread"); await clickElement(dbg, "pause"); - await waitForState(dbg, state => getIsWaitingOnBreak(getCurrentThread())); + await waitForState(dbg, () => getIsWaitingOnBreak(getCurrentThread())); info("Trigger some code in the worker and wait for pause"); await SpecialPowers.spawn(swTab.linkedBrowser, [], async function () { diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_sidebar_connection_state.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_sidebar_connection_state.js index d4d31a7522..757f596891 100644 --- a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_sidebar_connection_state.js +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_sidebar_connection_state.js @@ -39,7 +39,7 @@ add_task(async function () { usbRuntimeSidebarItem.querySelector(".qa-connect-button"); info("Simulate to happen connection error"); - mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async () => { throw new Error("Dummy connection error"); }; diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js index a5836ad50a..925ab62479 100644 --- a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js @@ -54,7 +54,7 @@ add_task(async function testSuccessfulConnectionAttempt() { add_task(async function testFailedConnectionAttempt() { const { doc, mocks, runtimeId, sessionId, tab } = await setupConnectionAttemptTest(); - mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async () => { throw new Error("failed"); }; @@ -168,8 +168,8 @@ add_task(async function testCancelledConnectionAttempt() { await setupConnectionAttemptTest(); info("Simulate a connection timeout"); - mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { - await new Promise(r => {}); + mocks.runtimeClientFactoryMock.createClientForRuntime = async () => { + await new Promise(() => {}); }; info("Click on the connect button and wait for the error message"); diff --git a/devtools/client/aboutdebugging/test/browser/helper-addons.js b/devtools/client/aboutdebugging/test/browser/helper-addons.js index e3a8be3761..dd299a3c0f 100644 --- a/devtools/client/aboutdebugging/test/browser/helper-addons.js +++ b/devtools/client/aboutdebugging/test/browser/helper-addons.js @@ -180,7 +180,7 @@ function prepareMockFilePicker(pathOrFile) { // Mock the file picker to select a test addon const MockFilePicker = SpecialPowers.MockFilePicker; - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); MockFilePicker.setFiles([file]); } /* exported prepareMockFilePicker */ diff --git a/devtools/client/aboutdebugging/test/browser/helper-mocks.js b/devtools/client/aboutdebugging/test/browser/helper-mocks.js index b1c9c910ff..a8536cf767 100644 --- a/devtools/client/aboutdebugging/test/browser/helper-mocks.js +++ b/devtools/client/aboutdebugging/test/browser/helper-mocks.js @@ -242,9 +242,28 @@ const silenceWorkerUpdates = function () { async function createLocalClientWrapper() { info("Create a local DevToolsClient"); + + // First, instantiate a DevToolsServer, the same way it is being done when running + // firefox --start-debugger-server const { - DevToolsServer, - } = require("resource://devtools/server/devtools-server.js"); + useDistinctSystemPrincipalLoader, + releaseDistinctSystemPrincipalLoader, + } = ChromeUtils.importESModule( + "resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs" + ); + const requester = {}; + const serverLoader = useDistinctSystemPrincipalLoader(requester); + registerCleanupFunction(() => { + releaseDistinctSystemPrincipalLoader(requester); + }); + const { DevToolsServer } = serverLoader.require( + "resource://devtools/server/devtools-server.js" + ); + DevToolsServer.init(); + DevToolsServer.registerAllActors(); + DevToolsServer.allowChromeProcess = true; + + // Then spawn a DevToolsClient connected to this new DevToolsServer const { DevToolsClient, } = require("resource://devtools/client/devtools-client.js"); @@ -252,8 +271,6 @@ async function createLocalClientWrapper() { ClientWrapper, } = require("resource://devtools/client/aboutdebugging/src/modules/client-wrapper.js"); - DevToolsServer.init(); - DevToolsServer.registerAllActors(); const client = new DevToolsClient(DevToolsServer.connectPipe()); await client.connect(); diff --git a/devtools/client/aboutdebugging/test/browser/mocks/helper-adb-mock.js b/devtools/client/aboutdebugging/test/browser/mocks/helper-adb-mock.js index f02ca02ee3..fce594684c 100644 --- a/devtools/client/aboutdebugging/test/browser/mocks/helper-adb-mock.js +++ b/devtools/client/aboutdebugging/test/browser/mocks/helper-adb-mock.js @@ -39,7 +39,7 @@ function disableAdbMock() { */ function createAdbMock() { const adbMock = {}; - adbMock.registerListener = function (listener) { + adbMock.registerListener = function () { console.log("MOCKED METHOD registerListener"); }; @@ -55,7 +55,7 @@ function createAdbMock() { console.log("MOCKED METHOD updateRuntimes"); }; - adbMock.unregisterListener = function (listener) { + adbMock.unregisterListener = function () { console.log("MOCKED METHOD unregisterListener"); }; diff --git a/devtools/client/aboutdebugging/test/browser/mocks/helper-runtime-client-factory-mock.js b/devtools/client/aboutdebugging/test/browser/mocks/helper-runtime-client-factory-mock.js index b74c229fcf..29d7b0ad4d 100644 --- a/devtools/client/aboutdebugging/test/browser/mocks/helper-runtime-client-factory-mock.js +++ b/devtools/client/aboutdebugging/test/browser/mocks/helper-runtime-client-factory-mock.js @@ -67,7 +67,7 @@ function disableRuntimeClientFactoryMock() { */ function createRuntimeClientFactoryMock() { const RuntimeClientFactoryMock = {}; - RuntimeClientFactoryMock.createClientForRuntime = function (runtime) { + RuntimeClientFactoryMock.createClientForRuntime = function () { console.log("MOCKED METHOD createClientForRuntime"); }; diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js index de6ee1fb32..8e71e3b108 100644 --- a/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js @@ -1,6 +1,6 @@ "use strict"; // Bug 1328293 -self.onfetch = function (event) { +self.onfetch = function () { // do nothing. }; diff --git a/devtools/client/aboutdebugging/test/xpcshell/test_runtime_default_preferences.js b/devtools/client/aboutdebugging/test/xpcshell/test_runtime_default_preferences.js index 637e42e078..465e11a43b 100644 --- a/devtools/client/aboutdebugging/test/xpcshell/test_runtime_default_preferences.js +++ b/devtools/client/aboutdebugging/test/xpcshell/test_runtime_default_preferences.js @@ -194,7 +194,7 @@ add_task(async function test_without_traits_with_error() { function createClientWrapper(preferencesFront) { const clientWrapper = { - getFront: name => { + getFront: () => { return preferencesFront; }, }; |