[Global] Update refs to SDK.multitargetNetworkManager

Bug: 1006759
Change-Id: Id9152c0982e46484e0254ef9559bedad62e1bc6e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2017146
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/front_end/Tests.js b/front_end/Tests.js
index 4121e00..7940251 100644
--- a/front_end/Tests.js
+++ b/front_end/Tests.js
@@ -866,7 +866,7 @@
   // See crbug.com/747724
   TestSuite.prototype.testOfflineNetworkConditions = async function() {
     const test = this;
-    SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
+    self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
 
     function finishRequest(request) {
       test.assertEquals(
@@ -899,7 +899,7 @@
       }
 
       self.SDK.consoleModel.addEventListener(SDK.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
-      SDK.multitargetNetworkManager.setNetworkConditions(preset);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(preset);
     }
 
     test.takeControl();
@@ -1448,7 +1448,7 @@
     this.takeControl();
 
     const testUserAgent = 'test user agent';
-    SDK.multitargetNetworkManager.setUserAgentOverride(testUserAgent);
+    self.SDK.multitargetNetworkManager.setUserAgentOverride(testUserAgent);
 
     function onRequestUpdated(event) {
       const request = event.data;
diff --git a/front_end/audits/AuditsPanel.js b/front_end/audits/AuditsPanel.js
index 7205667..25f09f2 100644
--- a/front_end/audits/AuditsPanel.js
+++ b/front_end/audits/AuditsPanel.js
@@ -334,7 +334,7 @@
         outlineEnabled: emulationModel.deviceOutlineSetting().get(),
         toolbarControlsEnabled: emulationModel.toolbarControlsEnabledSetting().get()
       },
-      network: {conditions: SDK.multitargetNetworkManager.networkConditions()}
+      network: {conditions: self.SDK.multitargetNetworkManager.networkConditions()}
     };
 
     emulationModel.toolbarControlsEnabledSetting().set(false);
@@ -369,7 +369,7 @@
       emulationModel.enabledSetting().set(this._stateBefore.emulation.enabled);
       emulationModel.deviceOutlineSetting().set(this._stateBefore.emulation.outlineEnabled);
       emulationModel.toolbarControlsEnabledSetting().set(this._stateBefore.emulation.toolbarControlsEnabled);
-      SDK.multitargetNetworkManager.setNetworkConditions(this._stateBefore.network.conditions);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(this._stateBefore.network.conditions);
       delete this._stateBefore;
     }
 
diff --git a/front_end/emulation/DeviceModeModel.js b/front_end/emulation/DeviceModeModel.js
index 9689e61..1912cec 100644
--- a/front_end/emulation/DeviceModeModel.js
+++ b/front_end/emulation/DeviceModeModel.js
@@ -603,7 +603,7 @@
    * @param {string} userAgent
    */
   _applyUserAgent(userAgent) {
-    SDK.multitargetNetworkManager.setUserAgentOverride(userAgent);
+    self.SDK.multitargetNetworkManager.setUserAgentOverride(userAgent);
   }
 
   /**
diff --git a/front_end/extensions/ExtensionServer.js b/front_end/extensions/ExtensionServer.js
index c173bde..74c2cbe 100644
--- a/front_end/extensions/ExtensionServer.js
+++ b/front_end/extensions/ExtensionServer.js
@@ -238,7 +238,7 @@
       }
     }
 
-    SDK.multitargetNetworkManager.setExtraHTTPHeaders(allHeaders);
+    self.SDK.multitargetNetworkManager.setExtraHTTPHeaders(allHeaders);
   }
 
   /**
@@ -428,7 +428,8 @@
   _onReload(message) {
     const options = /** @type {!ExtensionReloadOptions} */ (message.options || {});
 
-    SDK.multitargetNetworkManager.setUserAgentOverride(typeof options.userAgent === 'string' ? options.userAgent : '');
+    self.SDK.multitargetNetworkManager.setUserAgentOverride(
+        typeof options.userAgent === 'string' ? options.userAgent : '');
     let injectedScript;
     if (options.injectedScript) {
       injectedScript = '(function(){' + options.injectedScript + '})()';
diff --git a/front_end/main/MainImpl.js b/front_end/main/MainImpl.js
index d04b447..65f5c1d 100644
--- a/front_end/main/MainImpl.js
+++ b/front_end/main/MainImpl.js
@@ -196,7 +196,7 @@
     UI.Tooltip.installHandler(document);
     self.SDK.consoleModel = new SDK.ConsoleModel();
     self.Components.dockController = new Components.DockController(canDock);
-    SDK.multitargetNetworkManager = new SDK.MultitargetNetworkManager();
+    self.SDK.multitargetNetworkManager = new SDK.MultitargetNetworkManager();
     SDK.domDebuggerManager = new SDK.DOMDebuggerManager();
     self.SDK.targetManager.addEventListener(
         SDK.TargetManager.Events.SuspendStateChanged, this._onSuspendStateChanged.bind(this));
diff --git a/front_end/mobile_throttling/MobileThrottlingSelector.js b/front_end/mobile_throttling/MobileThrottlingSelector.js
index ae09b1c..8b41bbb 100644
--- a/front_end/mobile_throttling/MobileThrottlingSelector.js
+++ b/front_end/mobile_throttling/MobileThrottlingSelector.js
@@ -14,7 +14,7 @@
     this._populateCallback = populateCallback;
     this._selectCallback = selectCallback;
     throttlingManager().addEventListener(Events.RateChanged, this._conditionsChanged, this);
-    SDK.multitargetNetworkManager.addEventListener(
+    self.SDK.multitargetNetworkManager.addEventListener(
         SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._conditionsChanged, this);
     /** @type {!MobileThrottling.ConditionsList} */
     this._options = this._populateOptions();
@@ -25,7 +25,7 @@
    * @param {!MobileThrottling.Conditions} conditions
    */
   optionSelected(conditions) {
-    SDK.multitargetNetworkManager.setNetworkConditions(conditions.network);
+    self.SDK.multitargetNetworkManager.setNetworkConditions(conditions.network);
     throttlingManager().setCPUThrottlingRate(conditions.cpuThrottlingRate);
   }
 
@@ -40,7 +40,7 @@
   }
 
   _conditionsChanged() {
-    const networkConditions = SDK.multitargetNetworkManager.networkConditions();
+    const networkConditions = self.SDK.multitargetNetworkManager.networkConditions();
     const cpuThrottlingRate = throttlingManager().cpuThrottlingRate();
     for (let index = 0; index < this._options.length; ++index) {
       const option = this._options[index];
diff --git a/front_end/mobile_throttling/NetworkPanelIndicator.js b/front_end/mobile_throttling/NetworkPanelIndicator.js
index c6d1221..c25f964 100644
--- a/front_end/mobile_throttling/NetworkPanelIndicator.js
+++ b/front_end/mobile_throttling/NetworkPanelIndicator.js
@@ -8,7 +8,7 @@
     if (!self.UI.inspectorView.hasPanel('network')) {
       return;
     }
-    const manager = SDK.multitargetNetworkManager;
+    const manager = self.SDK.multitargetNetworkManager;
     manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChanged, updateVisibility);
     manager.addEventListener(SDK.MultitargetNetworkManager.Events.BlockedPatternsChanged, updateVisibility);
     manager.addEventListener(SDK.MultitargetNetworkManager.Events.InterceptorsChanged, updateVisibility);
@@ -19,7 +19,7 @@
       if (manager.isThrottling()) {
         icon = UI.Icon.create('smallicon-warning');
         icon.title = Common.UIString('Network throttling is enabled');
-      } else if (SDK.multitargetNetworkManager.isIntercepting()) {
+      } else if (self.SDK.multitargetNetworkManager.isIntercepting()) {
         icon = UI.Icon.create('smallicon-warning');
         icon.title = Common.UIString('Requests may be rewritten by local overrides');
       } else if (manager.isBlocking()) {
diff --git a/front_end/mobile_throttling/NetworkThrottlingSelector.js b/front_end/mobile_throttling/NetworkThrottlingSelector.js
index 9877e6c..fc44ed9 100644
--- a/front_end/mobile_throttling/NetworkThrottlingSelector.js
+++ b/front_end/mobile_throttling/NetworkThrottlingSelector.js
@@ -15,7 +15,7 @@
     this._selectCallback = selectCallback;
     this._customNetworkConditionsSetting = customNetworkConditionsSetting;
     this._customNetworkConditionsSetting.addChangeListener(this._populateOptions, this);
-    SDK.multitargetNetworkManager.addEventListener(
+    self.SDK.multitargetNetworkManager.addEventListener(
         SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._networkConditionsChanged, this);
     /** @type {!Array<?SDK.NetworkManager.Conditions>} */
     this._options;
@@ -31,7 +31,7 @@
    * @param {!SDK.NetworkManager.Conditions} conditions
    */
   optionSelected(conditions) {
-    SDK.multitargetNetworkManager.setNetworkConditions(conditions);
+    self.SDK.multitargetNetworkManager.setNetworkConditions(conditions);
   }
 
   _populateOptions() {
@@ -53,7 +53,7 @@
    * @return {boolean} returns false if selected condition no longer exists
    */
   _networkConditionsChanged() {
-    const value = SDK.multitargetNetworkManager.networkConditions();
+    const value = self.SDK.multitargetNetworkManager.networkConditions();
     for (let index = 0; index < this._options.length; ++index) {
       const option = this._options[index];
       if (option && option.download === value.download && option.upload === value.upload &&
diff --git a/front_end/mobile_throttling/ThrottlingManager.js b/front_end/mobile_throttling/ThrottlingManager.js
index 9895897..0396187 100644
--- a/front_end/mobile_throttling/ThrottlingManager.js
+++ b/front_end/mobile_throttling/ThrottlingManager.js
@@ -24,9 +24,9 @@
     /** @type {!SDK.NetworkManager.Conditions} */
     this._lastNetworkThrottlingConditions;
 
-    SDK.multitargetNetworkManager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChanged, () => {
+    self.SDK.multitargetNetworkManager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChanged, () => {
       this._lastNetworkThrottlingConditions = this._currentNetworkThrottlingConditions;
-      this._currentNetworkThrottlingConditions = SDK.multitargetNetworkManager.networkConditions();
+      this._currentNetworkThrottlingConditions = self.SDK.multitargetNetworkManager.networkConditions();
     });
 
     self.SDK.targetManager.observeModels(SDK.EmulationModel, this);
@@ -95,23 +95,25 @@
   createOfflineToolbarCheckbox() {
     const checkbox = new UI.ToolbarCheckbox(
         Common.UIString('Offline'), Common.UIString('Force disconnected from network'), forceOffline.bind(this));
-    SDK.multitargetNetworkManager.addEventListener(
+    self.SDK.multitargetNetworkManager.addEventListener(
         SDK.MultitargetNetworkManager.Events.ConditionsChanged, networkConditionsChanged);
-    checkbox.setChecked(SDK.multitargetNetworkManager.networkConditions() === SDK.NetworkManager.OfflineConditions);
+    checkbox.setChecked(
+        self.SDK.multitargetNetworkManager.networkConditions() === SDK.NetworkManager.OfflineConditions);
 
     /**
      * @this {!ThrottlingManager}
      */
     function forceOffline() {
       if (checkbox.checked()) {
-        SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
+        self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
       } else {
-        SDK.multitargetNetworkManager.setNetworkConditions(this._lastNetworkThrottlingConditions);
+        self.SDK.multitargetNetworkManager.setNetworkConditions(this._lastNetworkThrottlingConditions);
       }
     }
 
     function networkConditionsChanged() {
-      checkbox.setChecked(SDK.multitargetNetworkManager.networkConditions() === SDK.NetworkManager.OfflineConditions);
+      checkbox.setChecked(
+          self.SDK.multitargetNetworkManager.networkConditions() === SDK.NetworkManager.OfflineConditions);
     }
 
     return checkbox;
@@ -263,19 +265,19 @@
    */
   handleAction(context, actionId) {
     if (actionId === 'network-conditions.network-online') {
-      SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.NoThrottlingConditions);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.NoThrottlingConditions);
       return true;
     }
     if (actionId === 'network-conditions.network-low-end-mobile') {
-      SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Slow3GConditions);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Slow3GConditions);
       return true;
     }
     if (actionId === 'network-conditions.network-mid-tier-mobile') {
-      SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Fast3GConditions);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Fast3GConditions);
       return true;
     }
     if (actionId === 'network-conditions.network-offline') {
-      SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.OfflineConditions);
       return true;
     }
     return false;
diff --git a/front_end/network/BlockedURLsPane.js b/front_end/network/BlockedURLsPane.js
index 870fd5c..59fdae0 100644
--- a/front_end/network/BlockedURLsPane.js
+++ b/front_end/network/BlockedURLsPane.js
@@ -14,7 +14,7 @@
     this.registerRequiredCSS('network/blockedURLsPane.css');
 
     _instance = this;
-    this._manager = SDK.multitargetNetworkManager;
+    this._manager = self.SDK.multitargetNetworkManager;
     this._manager.addEventListener(SDK.MultitargetNetworkManager.Events.BlockedPatternsChanged, this._update, this);
 
     this._toolbar = new UI.Toolbar('', this.contentElement);
diff --git a/front_end/network/NetworkConfigView.js b/front_end/network/NetworkConfigView.js
index 338ae25..c98266f 100644
--- a/front_end/network/NetworkConfigView.js
+++ b/front_end/network/NetworkConfigView.js
@@ -141,7 +141,7 @@
       if (autoCheckbox.checked) {
         return;
       }
-      SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUserAgentSetting.get());
+      self.SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUserAgentSetting.get());
     });
     const customUserAgentSelectBox = section.createChild('div', 'network-config-ua-custom');
     autoCheckbox.addEventListener('change', userAgentSelectBoxChanged);
@@ -159,7 +159,7 @@
       customSelectAndInput.input.disabled = !useCustomUA;
       customSelectAndInput.error.hidden = !useCustomUA;
       const customUA = useCustomUA ? customUserAgentSetting.get() : '';
-      SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUA);
+      self.SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUA);
     }
   }
 }
diff --git a/front_end/network/NetworkLogView.js b/front_end/network/NetworkLogView.js
index 0ee3cb1..2084119 100644
--- a/front_end/network/NetworkLogView.js
+++ b/front_end/network/NetworkLogView.js
@@ -1354,7 +1354,7 @@
 
     if (request) {
       const maxBlockedURLLength = 20;
-      const manager = SDK.multitargetNetworkManager;
+      const manager = self.SDK.multitargetNetworkManager;
       let patterns = manager.blockedPatterns();
 
       /**
@@ -1485,13 +1485,13 @@
 
   _clearBrowserCache() {
     if (confirm(Common.UIString('Are you sure you want to clear browser cache?'))) {
-      SDK.multitargetNetworkManager.clearBrowserCache();
+      self.SDK.multitargetNetworkManager.clearBrowserCache();
     }
   }
 
   _clearBrowserCookies() {
     if (confirm(Common.UIString('Are you sure you want to clear browser cookies?'))) {
-      SDK.multitargetNetworkManager.clearBrowserCookies();
+      self.SDK.multitargetNetworkManager.clearBrowserCookies();
     }
   }
 
diff --git a/front_end/persistence/NetworkPersistenceManager.js b/front_end/persistence/NetworkPersistenceManager.js
index 8d0bc54..6b2cbe9 100644
--- a/front_end/persistence/NetworkPersistenceManager.js
+++ b/front_end/persistence/NetworkPersistenceManager.js
@@ -360,7 +360,7 @@
      */
     function innerUpdateInterceptionPatterns() {
       if (!this._active) {
-        return SDK.multitargetNetworkManager.setInterceptionHandlerForPatterns([], this._interceptionHandlerBound);
+        return self.SDK.multitargetNetworkManager.setInterceptionHandlerForPatterns([], this._interceptionHandlerBound);
       }
       const patterns = new Set();
       const indexFileName = 'index.html';
@@ -372,7 +372,7 @@
         }
       }
 
-      return SDK.multitargetNetworkManager.setInterceptionHandlerForPatterns(
+      return self.SDK.multitargetNetworkManager.setInterceptionHandlerForPatterns(
           Array.from(patterns).map(
               pattern =>
                   ({urlPattern: pattern, interceptionStage: Protocol.Network.InterceptionStage.HeadersReceived})),
diff --git a/front_end/sdk/CompilerSourceMappingContentProvider.js b/front_end/sdk/CompilerSourceMappingContentProvider.js
index 3f2a8a3..963f975 100644
--- a/front_end/sdk/CompilerSourceMappingContentProvider.js
+++ b/front_end/sdk/CompilerSourceMappingContentProvider.js
@@ -74,15 +74,16 @@
    */
   requestContent() {
     return new Promise(resolve => {
-      SDK.multitargetNetworkManager.loadResource(this._sourceURL, (success, _headers, content, errorDescription) => {
-        if (!success) {
-          const error = ls`Could not load content for ${this._sourceURL} (${errorDescription.message})`;
-          console.error(error);
-          resolve({error, isEncoded: false});
-        } else {
-          resolve({content, isEncoded: false});
-        }
-      });
+      self.SDK.multitargetNetworkManager.loadResource(
+          this._sourceURL, (success, _headers, content, errorDescription) => {
+            if (!success) {
+              const error = ls`Could not load content for ${this._sourceURL} (${errorDescription.message})`;
+              console.error(error);
+              resolve({error, isEncoded: false});
+            } else {
+              resolve({content, isEncoded: false});
+            }
+          });
     });
   }
 
diff --git a/front_end/sdk/NetworkManager.js b/front_end/sdk/NetworkManager.js
index adb3825..bcf2011 100644
--- a/front_end/sdk/NetworkManager.js
+++ b/front_end/sdk/NetworkManager.js
@@ -807,7 +807,7 @@
   requestIntercepted(
       interceptionId, request, frameId, resourceType, isNavigationRequest, isDownload, redirectUrl, authChallenge,
       responseErrorReason, responseStatusCode, responseHeaders, requestId) {
-    SDK.multitargetNetworkManager._requestIntercepted(new InterceptedRequest(
+    self.SDK.multitargetNetworkManager._requestIntercepted(new InterceptedRequest(
         this._manager.target().networkAgent(), interceptionId, request, frameId, resourceType, isNavigationRequest,
         isDownload, redirectUrl, authChallenge, responseErrorReason, responseStatusCode, responseHeaders, requestId));
   }
@@ -904,7 +904,7 @@
    * @return {?NetworkRequest}
    */
   _maybeAdoptMainResourceRequest(requestId) {
-    const request = SDK.multitargetNetworkManager._inflightMainResourceRequests.get(requestId);
+    const request = self.SDK.multitargetNetworkManager._inflightMainResourceRequests.get(requestId);
     if (!request) {
       return null;
     }
@@ -926,7 +926,7 @@
     // The following relies on the fact that loaderIds and requestIds are
     // globally unique and that the main request has them equal.
     if (networkRequest.loaderId === networkRequest.requestId()) {
-      SDK.multitargetNetworkManager._inflightMainResourceRequests.set(networkRequest.requestId(), networkRequest);
+      self.SDK.multitargetNetworkManager._inflightMainResourceRequests.set(networkRequest.requestId(), networkRequest);
     }
 
     this._manager.dispatchEventToListeners(Events.RequestStarted, networkRequest);
@@ -961,7 +961,7 @@
     this._manager.dispatchEventToListeners(Events.RequestFinished, networkRequest);
     delete this._inflightRequestsById[networkRequest.requestId()];
     delete this._inflightRequestsByURL[networkRequest.url()];
-    SDK.multitargetNetworkManager._inflightMainResourceRequests.delete(networkRequest.requestId());
+    self.SDK.multitargetNetworkManager._inflightMainResourceRequests.delete(networkRequest.requestId());
 
     if (shouldReportCorbBlocking) {
       const message = Common.UIString.UIString(
diff --git a/front_end/sdk/SourceMap.js b/front_end/sdk/SourceMap.js
index 7035c2e..b358d1b 100644
--- a/front_end/sdk/SourceMap.js
+++ b/front_end/sdk/SourceMap.js
@@ -229,7 +229,7 @@
    */
   static async load(sourceMapURL, compiledURL) {
     let content = await new Promise((resolve, reject) => {
-      SDK.multitargetNetworkManager.loadResource(sourceMapURL, (success, _headers, content, errorDescription) => {
+      self.SDK.multitargetNetworkManager.loadResource(sourceMapURL, (success, _headers, content, errorDescription) => {
         if (!content || !success) {
           const error = new Error(ls`Could not load content for ${sourceMapURL}: ${errorDescription.message}`);
           reject(error);
diff --git a/front_end/security/SecurityPanel.js b/front_end/security/SecurityPanel.js
index 6fef9e5..2b7d52a 100644
--- a/front_end/security/SecurityPanel.js
+++ b/front_end/security/SecurityPanel.js
@@ -50,7 +50,7 @@
   static createCertificateViewerButtonForOrigin(text, origin) {
     const certificateButton = UI.createTextButton(text, async e => {
       e.consume();
-      const names = await SDK.multitargetNetworkManager.getCertificate(origin);
+      const names = await self.SDK.multitargetNetworkManager.getCertificate(origin);
       if (names.length > 0) {
         Host.InspectorFrontendHost.showCertificateViewer(names);
       }
diff --git a/front_end/timeline/TimelinePanel.js b/front_end/timeline/TimelinePanel.js
index 4022d9f..4b1bd14 100644
--- a/front_end/timeline/TimelinePanel.js
+++ b/front_end/timeline/TimelinePanel.js
@@ -266,7 +266,7 @@
     this._showSettingsPaneSetting = self.Common.settings.createSetting('timelineShowSettingsToolbar', false);
     this._showSettingsPaneButton = new UI.ToolbarSettingToggle(
         this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIString('Capture settings'));
-    SDK.multitargetNetworkManager.addEventListener(
+    self.SDK.multitargetNetworkManager.addEventListener(
         SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShowSettingsToolbarButton, this);
     MobileThrottling.throttlingManager().addEventListener(
         MobileThrottling.ThrottlingManager.Events.RateChanged, this._updateShowSettingsToolbarButton, this);
@@ -485,7 +485,7 @@
     if (MobileThrottling.throttlingManager().cpuThrottlingRate() !== 1) {
       messages.push(Common.UIString('- CPU throttling is enabled'));
     }
-    if (SDK.multitargetNetworkManager.isThrottling()) {
+    if (self.SDK.multitargetNetworkManager.isThrottling()) {
       messages.push(Common.UIString('- Network throttling is enabled'));
     }
     if (this._captureLayersAndPicturesSetting.get()) {