Bug 1566850 - Remove target.activeConsole usage in Netmonitor. r=Honza.
☠☠ backed out by 535b50b4c504 ☠ ☠
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Fri, 13 Dec 2019 09:11:44 +0000
changeset 506848 55ac64d7472555b142b0de681fd2da8d12944bb5
parent 506847 33c4706a425593d57c2dce5073ea7ddf5b5b8223
child 506849 4deadf97378f63cf04997ca52a9ec7aee18dc0a5
push id36913
push useropoprus@mozilla.com
push dateFri, 13 Dec 2019 16:53:24 +0000
treeherdermozilla-central@1ed684598bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1566850
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1566850 - Remove target.activeConsole usage in Netmonitor. r=Honza. Differential Revision: https://phabricator.services.mozilla.com/D56689
devtools/client/netmonitor/initializer.js
devtools/client/netmonitor/src/connector/firefox-connector.js
devtools/client/netmonitor/src/har/har-automation.js
devtools/client/netmonitor/test/head.js
--- a/devtools/client/netmonitor/initializer.js
+++ b/devtools/client/netmonitor/initializer.js
@@ -76,17 +76,18 @@ if (window.location.protocol === "chrome
     targetFromURL,
   } = require("devtools/client/framework/target-from-url");
 
   (async function() {
     try {
       const target = await targetFromURL(url);
 
       // Start the network event listening as it is done in the toolbox code
-      await target.activeConsole.startListeners(["NetworkActivity"]);
+      const consoleFront = await target.getFront("console");
+      await consoleFront.startListeners(["NetworkActivity"]);
 
       // Create a fake toolbox object
       const toolbox = {
         target,
         viewSourceInDebugger() {
           throw new Error(
             "toolbox.viewSourceInDebugger is not implement from a tab"
           );
--- a/devtools/client/netmonitor/src/connector/firefox-connector.js
+++ b/devtools/client/netmonitor/src/connector/firefox-connector.js
@@ -53,17 +53,17 @@ class FirefoxConnector {
     this.actions = actions;
     this.getState = getState;
     this.tabTarget = connection.tabConnection.tabTarget;
     this.toolbox = connection.toolbox;
 
     // The owner object (NetMonitorAPI) received all events.
     this.owner = connection.owner;
 
-    this.webConsoleFront = this.tabTarget.activeConsole;
+    this.webConsoleFront = await this.tabTarget.getFront("console");
 
     this.dataProvider = new FirefoxDataProvider({
       webConsoleFront: this.webConsoleFront,
       actions: this.actions,
       owner: this.owner,
     });
 
     // Register all listeners
--- a/devtools/client/netmonitor/src/har/har-automation.js
+++ b/devtools/client/netmonitor/src/har/har-automation.js
@@ -54,23 +54,23 @@ HarAutomation.prototype = {
 
     if (this.tabWatcher) {
       this.tabWatcher.disconnect();
     }
   },
 
   // Automation
 
-  startMonitoring: function(client, callback) {
+  startMonitoring: async function(client, callback) {
     if (!client) {
       return;
     }
 
     this.debuggerClient = client;
-    this.webConsoleFront = this.toolbox.target.activeConsole;
+    this.webConsoleFront = await this.toolbox.target.getFront("console");
 
     this.tabWatcher = new TabWatcher(this.toolbox, this);
     this.tabWatcher.connect();
   },
 
   pageLoadBegin: function(response) {
     this.resetCollector();
   },
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -357,25 +357,28 @@ function initNetMonitor(url, enableCache
       info("Disabling cache and reloading page.");
       const requestsDone = waitForAllRequestsFinished(monitor);
       const markersDone = waitForTimelineMarkers(monitor);
       await toggleCache(target, true);
       await Promise.all([requestsDone, markersDone]);
       info(
         "Cache disabled when the current and all future toolboxes are open."
       );
+
+      const consoleFront = await target.getFront("console");
+
       // Remove any requests generated by the reload while toggling the cache to
       // avoid interfering with the test.
       isnot(
-        [...target.activeConsole.getNetworkEvents()].length,
+        [...consoleFront.getNetworkEvents()].length,
         0,
         "Request to reconfigure the tab was recorded."
       );
       info("Clearing requests in the console client.");
-      target.activeConsole.clearNetworkRequests();
+      await consoleFront.clearNetworkRequests();
       info("Clearing requests in the UI.");
 
       store.dispatch(Actions.clearRequests());
     }
 
     return { tab, monitor, toolbox };
   })();
 }