From 36456c9b0e794d9b2b6ec13b25e1e1947db38fe8 Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Wed, 27 Jan 2021 14:38:45 +0000 Subject: [PATCH] Bug 1686723 - [devtools] Remove unused network throttling code from RDM client code. r=bomsy,devtools-backward-compat-reviewers. Now that network resources are enabled on the server, RDM is using the network actor to control network throttling. We can remove all the RDM client code that was still trying to call the responsive actor. We can't remove the methods from the ResponsiveActor yet though, since the Netmonitor will use it when there's no network resource server side support, which is still the case for the Browser Toolbox. Differential Revision: https://phabricator.services.mozilla.com/D102766 --- .../browser/browser_network_throttling.js | 6 +----- devtools/client/responsive/ui.js | 19 +++---------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/devtools/client/responsive/test/browser/browser_network_throttling.js b/devtools/client/responsive/test/browser/browser_network_throttling.js index f9a504498e45..eab7ff40a8cb 100644 --- a/devtools/client/responsive/test/browser/browser_network_throttling.js +++ b/devtools/client/responsive/test/browser/browser_network_throttling.js @@ -37,11 +37,7 @@ function testNetworkThrottlingSelectorLabel(ui, expected) { } var testNetworkThrottlingState = async function(ui, expected) { - const front = - ui.hasResourceWatcherSupport && ui.networkFront - ? ui.networkFront - : ui.responsiveFront; - const state = await front.getNetworkThrottling(); + const state = await ui.networkFront.getNetworkThrottling(); Assert.deepEqual( state, expected, diff --git a/devtools/client/responsive/ui.js b/devtools/client/responsive/ui.js index bf57b29fd64e..988625f3c54b 100644 --- a/devtools/client/responsive/ui.js +++ b/devtools/client/responsive/ui.js @@ -123,12 +123,6 @@ class ResponsiveUI { return this.resourceWatcher.watcherFront; } - get hasResourceWatcherSupport() { - return this.resourceWatcher.hasResourceWatcherSupport( - this.resourceWatcher.TYPES.NETWORK_EVENT - ); - } - /** * Open RDM while preserving the state of the page. */ @@ -415,9 +409,7 @@ class ResponsiveUI { { onAvailable: this.onNetworkResourceAvailable } ); - if (this.hasResourceWatcherSupport) { - this.networkFront = await this.watcherFront.getNetworkParentActor(); - } + this.networkFront = await this.watcherFront.getNetworkParentActor(); } /** @@ -851,18 +843,13 @@ class ResponsiveUI { * (This is always immediate, so it's always false.) */ async updateNetworkThrottling(enabled, profile) { - const throttlingFront = - this.hasResourceWatcherSupport && this.networkFront - ? this.networkFront - : this.responsiveFront; - if (!enabled) { - await throttlingFront.clearNetworkThrottling(); + await this.networkFront.clearNetworkThrottling(); return false; } const data = throttlingProfiles.find(({ id }) => id == profile); const { download, upload, latency } = data; - await throttlingFront.setNetworkThrottling({ + await this.networkFront.setNetworkThrottling({ downloadThroughput: download, uploadThroughput: upload, latency,