From 17460eb5c7dad2b8e6c0300d35333cf63fec941e Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Tue, 7 Jul 2020 15:20:10 +0000 Subject: [PATCH] Bug 1619221 - Remove can-debug-sw-updated event r=ladybenko,daisuke,devtools-backward-compat-reviewers Depends on D81343 All the client side consumers for the event have been removed. Since we don't support forward compatibility, we can simply remove the event. Differential Revision: https://phabricator.services.mozilla.com/D81344 --- devtools/server/actors/device.js | 12 -------- .../shared/service-workers-debug-helper.js | 30 ------------------- devtools/shared/specs/device.js | 9 +----- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/devtools/server/actors/device.js b/devtools/server/actors/device.js index 2ea8f412a9f9..66b105eb1d34 100644 --- a/devtools/server/actors/device.js +++ b/devtools/server/actors/device.js @@ -9,10 +9,8 @@ const Services = require("Services"); const protocol = require("devtools/shared/protocol"); const { LongStringActor } = require("devtools/server/actors/string"); const { - addDebugServiceWorkersListener, canDebugServiceWorkers, isParentInterceptEnabled, - removeDebugServiceWorkersListener, } = require("devtools/shared/service-workers-debug-helper"); const { DevToolsServer } = require("devtools/server/devtools-server"); @@ -30,11 +28,6 @@ exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, { this._window.addEventListener("pageshow", this._onPageShow, true); } this._acquireWakeLock(); - - this._onDebugServiceWorkersUpdated = this._onDebugServiceWorkersUpdated.bind( - this - ); - addDebugServiceWorkersListener(this._onDebugServiceWorkersUpdated); }, destroy: function() { @@ -43,11 +36,6 @@ exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, { if (this._window) { this._window.removeEventListener("pageshow", this._onPageShow, true); } - removeDebugServiceWorkersListener(this._onDebugServiceWorkersUpdated); - }, - - _onDebugServiceWorkersUpdated: function() { - this.emit("can-debug-sw-updated", canDebugServiceWorkers()); }, getDescription: function() { diff --git a/devtools/shared/service-workers-debug-helper.js b/devtools/shared/service-workers-debug-helper.js index a31d77121264..d9ad0636ac8f 100644 --- a/devtools/shared/service-workers-debug-helper.js +++ b/devtools/shared/service-workers-debug-helper.js @@ -19,36 +19,8 @@ XPCOMUtils.defineLazyServiceGetter( * This depends both on the current multiprocess (e10s) configuration and on the * usage of the new service worker implementation * (dom.serviceWorkers.parent_intercept = true). - * - * Since this can be changed on the fly, there are subscribe/unsubscribe functions - * to get notified of this. */ -const PROCESS_COUNT_PREF = "dom.ipc.processCount"; -const MULTI_OPTOUT_PREF = "dom.ipc.multiOptOut"; - -function addDebugServiceWorkersListener(listener) { - // Some notes about these observers: - // - nsIPrefBranch.addObserver observes prefixes. In reality, watching - // PROCESS_COUNT_PREF watches two separate prefs: - // dom.ipc.processCount *and* dom.ipc.processCount.web. Because these - // are the two ways that we control the number of content processes, - // that works perfectly fine. - // - The user might opt in or out of multi by setting the multi opt out - // pref. That affects whether we need to show our warning, so we need to - // update our state when that pref changes. - // - In all cases, we don't have to manually check which pref changed to - // what. The platform code in nsIXULRuntime.maxWebProcessCount does all - // of that for us. - Services.prefs.addObserver(PROCESS_COUNT_PREF, listener); - Services.prefs.addObserver(MULTI_OPTOUT_PREF, listener); -} - -function removeDebugServiceWorkersListener(listener) { - Services.prefs.removeObserver(PROCESS_COUNT_PREF, listener); - Services.prefs.removeObserver(MULTI_OPTOUT_PREF, listener); -} - function canDebugServiceWorkers() { const isE10s = Services.appinfo.browserTabsRemoteAutostart; const processCount = Services.appinfo.maxWebProcessCount; @@ -65,8 +37,6 @@ function isParentInterceptEnabled() { } module.exports = { - addDebugServiceWorkersListener, canDebugServiceWorkers, isParentInterceptEnabled, - removeDebugServiceWorkersListener, }; diff --git a/devtools/shared/specs/device.js b/devtools/shared/specs/device.js index af02d297e561..ff2fc99d7478 100644 --- a/devtools/shared/specs/device.js +++ b/devtools/shared/specs/device.js @@ -3,17 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { Arg, RetVal, generateActorSpec } = require("devtools/shared/protocol"); +const { RetVal, generateActorSpec } = require("devtools/shared/protocol"); const deviceSpec = generateActorSpec({ typeName: "device", - events: { - "can-debug-sw-updated": { - type: "can-debug-sw-updated", - canDebugServiceWorkers: Arg(0, "boolean"), - }, - }, - methods: { getDescription: { request: {}, response: { value: RetVal("json") } }, screenshotToDataURL: {