Backed out 3 changesets (bug 1570242) for devtools failure in /webconsole/test/node/components/webconsole-wrapper.test.js. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Wed, 21 Aug 2019 13:13:15 +0300
changeset 489157 beeb07bef59ca1b3a0a8c399048728e476c5b3b7
parent 489156 a10ff596bbc9b6d7064e8f102da6957b24f43f4b
child 489158 a531fd366fdf53689298c575d229505a2ae9005d
push id36465
push userdvarga@mozilla.com
push dateWed, 21 Aug 2019 16:47:43 +0000
treeherdermozilla-central@4ab60925635c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1570242
milestone70.0a1
backs out854e62f7f1aed9c435bceb173eba119a90dc6eba
304366165980bc36f3e4a1fa7d1b1b04b89b9249
a213b28dd40fe20af80a2bafcc6ae7c075da157a
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
Backed out 3 changesets (bug 1570242) for devtools failure in /webconsole/test/node/components/webconsole-wrapper.test.js. CLOSED TREE Backed out changeset 854e62f7f1ae (bug 1570242) Backed out changeset 304366165980 (bug 1570242) Backed out changeset a213b28dd40f (bug 1570242)
devtools/client/webconsole/browser-console.js
devtools/client/webconsole/panel.js
devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
devtools/client/webconsole/test/browser/browser_webconsole_click_function_to_source.js
devtools/client/webconsole/test/browser/browser_webconsole_errors_after_page_reload.js
devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe.js
devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe2.js
devtools/client/webconsole/test/browser/browser_webconsole_location_logpoint_debugger_link.js
devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
devtools/client/webconsole/test/browser/browser_webconsole_nodes_highlight.js
devtools/client/webconsole/test/browser/browser_webconsole_nodes_select.js
devtools/client/webconsole/test/browser/browser_webconsole_optimized_out_vars.js
devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
devtools/client/webconsole/test/browser/browser_webconsole_visibility_messages.js
devtools/client/webconsole/test/browser/browser_webconsole_warning_groups_toggle.js
devtools/client/webconsole/test/browser/browser_webconsole_worker_evaluate.js
devtools/client/webconsole/test/browser/head.js
devtools/client/webconsole/webconsole-connection-proxy.js
devtools/client/webconsole/webconsole-ui.js
devtools/client/webconsole/webconsole-wrapper.js
devtools/client/webconsole/webconsole.js
--- a/devtools/client/webconsole/browser-console.js
+++ b/devtools/client/webconsole/browser-console.js
@@ -33,28 +33,23 @@ class BrowserConsole extends WebConsole 
    *        The target that the browser console will connect to.
    * @param nsIDOMWindow iframeWindow
    *        The window where the browser console UI is already loaded.
    * @param nsIDOMWindow chromeWindow
    *        The window of the browser console owner.
    * @param Boolean fissionSupport
    */
   constructor(target, iframeWindow, chromeWindow, fissionSupport = false) {
-    super(null, iframeWindow, chromeWindow, true, fissionSupport);
+    super(target, iframeWindow, chromeWindow, true, fissionSupport);
 
-    this._browserConsoleTarget = target;
     this._telemetry = new Telemetry();
     this._bcInitializer = null;
     this._bcDestroyer = null;
   }
 
-  get currentTarget() {
-    return this._browserConsoleTarget;
-  }
-
   /**
    * Initialize the Browser Console instance.
    *
    * @return object
    *         A promise for the initialization.
    */
   init() {
     if (this._bcInitializer) {
@@ -96,17 +91,17 @@ class BrowserConsole extends WebConsole 
     }
 
     this._bcDestroyer = (async () => {
       // browserconsole is not connected with a toolbox so we pass -1 as the
       // toolbox session id.
       this._telemetry.toolClosed("browserconsole", -1, this);
 
       await super.destroy();
-      await this.currentTarget.destroy();
+      await this.target.destroy();
       this.chromeWindow.close();
     })();
 
     return this._bcDestroyer;
   }
 }
 
 /**
--- a/devtools/client/webconsole/panel.js
+++ b/devtools/client/webconsole/panel.js
@@ -60,21 +60,17 @@ WebConsolePanel.prototype = {
           });
         });
       }
 
       const webConsoleUIWindow = iframe.contentWindow.wrappedJSObject;
       const chromeWindow = iframe.ownerDocument.defaultView;
 
       // Open the Web Console.
-      this.hud = new WebConsole(
-        this._toolbox,
-        webConsoleUIWindow,
-        chromeWindow
-      );
+      this.hud = new WebConsole(this.target, webConsoleUIWindow, chromeWindow);
       await this.hud.init();
 
       // Pipe 'reloaded' event from WebConsoleUI to WebConsolePanel.
       // These events are listened by the Toolbox.
       this.hud.ui.on("reloaded", () => {
         this.emit("reloaded");
       });
 
@@ -84,17 +80,17 @@ WebConsolePanel.prototype = {
       const msg = "WebConsolePanel open failed. " + e.error + ": " + e.message;
       dump(msg + "\n");
       console.error(msg, e);
     }
 
     return this;
   },
 
-  get currentTarget() {
+  get target() {
     return this._toolbox.target;
   },
 
   _isReady: false,
   get isReady() {
     return this._isReady;
   },
 
--- a/devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
+++ b/devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
@@ -12,17 +12,17 @@ const TEST_URI =
 add_task(async function() {
   const wcHud = await openNewTabAndConsole(TEST_URI);
   ok(wcHud, "web console opened");
 
   const bcHud = await BrowserConsoleManager.toggleBrowserConsole();
   ok(bcHud, "browser console opened");
 
   // Cause an exception in a script loaded with the DevTools loader.
-  const toolbox = wcHud.toolbox;
+  const toolbox = gDevTools.getToolbox(wcHud.target);
   const oldPanels = toolbox._toolPanels;
   // non-iterable
   toolbox._toolPanels = {};
 
   function fixToolbox() {
     toolbox._toolPanels = oldPanels;
   }
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_click_function_to_source.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_click_function_to_source.js
@@ -33,16 +33,16 @@ add_task(async function() {
   });
   const { node } = await onLoggedFunction;
   const jumpIcon = node.querySelector(".jump-definition");
   ok(jumpIcon, "A jump to definition button is rendered, as expected");
 
   info("Click on the jump to definition button.");
   jumpIcon.click();
 
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
   await waitForSelectedSource(dbg, TEST_SCRIPT_URI);
 
   const pendingLocation = dbg.selectors.getPendingSelectedLocation();
   const { line } = pendingLocation;
   is(line, 9, "Debugger is open at the expected line");
 });
--- a/devtools/client/webconsole/test/browser/browser_webconsole_errors_after_page_reload.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_errors_after_page_reload.js
@@ -10,17 +10,17 @@
 const TEST_URI =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-error.html";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Reload the content window");
-  const onNavigate = hud.currentTarget.once("navigate");
+  const onNavigate = hud.target.once("navigate");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.wrappedJSObject.location.reload();
   });
   await onNavigate;
   info("Target navigated");
 
   // On e10s, the exception is triggered in child process
   // and is ignored by test harness
--- a/devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe.js
@@ -25,17 +25,17 @@ add_task(async function() {
     "foo2 = 'newFoo'; window.foo2",
     "newFoo",
     ".result"
   );
   ok(true, "'newFoo' is displayed after adding `foo2`");
 
   info("Open the debugger and then select the console again");
   await openDebugger();
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
 
   await openConsole();
 
   info("Check `foo + foo2` value");
   await executeAndWaitForMessage(
     hud,
     "foo + foo2",
--- a/devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe2.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_eval_in_debugger_stackframe2.js
@@ -13,17 +13,17 @@ const TEST_URI =
 
 add_task(async function() {
   info("open the console");
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("open the debugger");
   await openDebugger();
 
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
 
   // firstCall calls secondCall, which has a debugger statement, so we'll be paused.
   const onFirstCallMessageReceived = waitForMessage(hud, "undefined");
 
   const unresolvedSymbol = Symbol();
   let firstCallEvaluationResult = unresolvedSymbol;
   onFirstCallMessageReceived.then(message => {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_location_logpoint_debugger_link.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_location_logpoint_debugger_link.js
@@ -20,17 +20,17 @@ add_task(async function() {
   // Eliminate interference from "saved" breakpoints
   // when running the test multiple times
   await clearDebuggerPreferences();
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Open the Debugger panel");
   await openDebugger();
 
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
   await selectSource(dbg, "test-location-debugger-link-logpoint-1.js");
 
   info("Add a logpoint with an invalid expression");
   await setLogPoint(dbg, 7, "undefinedVariable");
 
   info("Add a logpoint with a valid expression");
   await setLogPoint(dbg, 8, "`a is ${a}`");
@@ -106,17 +106,17 @@ add_task(async function() {
   }
 
   await clearDebuggerPreferences();
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Open the Debugger panel");
   await openDebugger();
 
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
 
   info("Add a logpoint to the first file");
   await selectSource(dbg, "test-location-debugger-link-logpoint-1.js");
   await setLogPoint(dbg, 8, "`a is ${a}`");
 
   info("Add a logpoint to the second file");
   await selectSource(dbg, "test-location-debugger-link-logpoint-2.js");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
@@ -32,17 +32,17 @@ add_task(async function() {
   const tab3 = await addTab(TEST_URI, { window: win2 });
   const tab4 = await addTab(TEST_URI, { window: win2 });
 
   info("Opening console in each test tab");
   const tabs = [tab1, tab2, tab3, tab4];
   for (const tab of tabs) {
     // Open the console in tab${i}.
     const hud = await openConsole(tab);
-    const browser = hud.currentTarget.tab.linkedBrowser;
+    const browser = hud.target.tab.linkedBrowser;
     const message = "message for tab " + tabs.indexOf(tab);
 
     // Log a message in the newly opened console.
     const onMessage = waitForMessage(hud, message);
     await ContentTask.spawn(browser, message, function(msg) {
       content.console.log(msg);
     });
     await onMessage;
--- a/devtools/client/webconsole/test/browser/browser_webconsole_nodes_highlight.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_nodes_highlight.js
@@ -24,17 +24,17 @@ const TEST_URI = "data:text/html;charset
 // Import helpers registering the test-actor in remote targets
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/shared/test/test-actor-registry.js",
   this
 );
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
 
   await registerTestActor(toolbox.target.client);
   const testActor = await getTestActor(toolbox);
 
   await ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.wrappedJSObject.logNode("h1");
   });
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_nodes_select.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_nodes_select.js
@@ -18,17 +18,17 @@ const HTML = `
       }
     </script>
   </html>
 `;
 const TEST_URI = "data:text/html;charset=utf-8," + encodeURI(HTML);
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
 
   // Loading the inspector panel at first, to make it possible to listen for
   // new node selections
   await toolbox.loadTool("inspector");
   const inspector = toolbox.getPanel("inspector");
 
   await ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.wrappedJSObject.logNode("h1");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_optimized_out_vars.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_optimized_out_vars.js
@@ -11,17 +11,17 @@ const TEST_URI =
   "test/browser/" +
   "test-closure-optimized-out.html";
 
 add_task(async function() {
   const breakpointLine = 18;
   const hud = await openNewTabAndConsole(TEST_URI);
   await openDebugger();
 
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
 
   await selectSource(dbg, "test-closure-optimized-out.html");
   await addBreakpoint(dbg, "test-closure-optimized-out.html", breakpointLine);
 
   // Cause the debuggee to pause
   await pauseDebugger(dbg);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
@@ -26,17 +26,17 @@ add_task(async function() {
   ok(!prefValue, "Messages should have no timestamp by default (pref check)");
   ok(
     !message.node.querySelector(".timestamp"),
     "Messages should have no timestamp by default (element check)"
   );
 
   info("Open the settings panel");
   const observer = new PrefObserver("");
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const { panelDoc, panelWin } = await toolbox.selectTool("options");
 
   info("Change Timestamp preference");
   const prefChanged = observer.once(PREF_MESSAGE_TIMESTAMP, () => {});
   const checkbox = panelDoc.getElementById("webconsole-timestamp-messages");
 
   // We use executeSoon here to ensure that the element is in view and clickable.
   checkbox.scrollIntoView();
--- a/devtools/client/webconsole/test/browser/browser_webconsole_visibility_messages.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_visibility_messages.js
@@ -20,17 +20,17 @@ const HTML = `
     </body>
   </html>
 `;
 const TEST_URI = "data:text/html;charset=utf-8," + encodeURI(HTML);
 const MESSAGES_COUNT = 10;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
 
   info("Log one message in the console");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.wrappedJSObject.log("in-console log");
   });
   await waitFor(() => findMessage(hud, "in-console log"));
 
   info("select the inspector");
@@ -80,17 +80,17 @@ add_task(async function() {
     "All the messages logged when the console was hidden were displayed."
   );
 });
 
 // Similar scenario, but with the split console on the inspector panel.
 // Here, the messages should still be logged.
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
 
   info("Log one message in the console");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.wrappedJSObject.log("in-console log");
   });
   await waitFor(() => findMessage(hud, "in-console log"));
 
   info("select the inspector");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_warning_groups_toggle.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_warning_groups_toggle.js
@@ -273,17 +273,17 @@ async function toggleWarningGroupPrefere
       WARNING_GROUP_PREF,
       !Services.prefs.getBoolPref(WARNING_GROUP_PREF)
     );
     return;
   }
 
   info("Open the settings panel");
   const observer = new PrefObserver("");
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const { panelDoc, panelWin } = await toolbox.selectTool("options");
 
   info("Change warning preference");
   const prefChanged = observer.once(WARNING_GROUP_PREF, () => {});
   const checkbox = panelDoc.getElementById("webconsole-warning-groups");
 
   // We use executeSoon here to ensure that the element is in view and clickable.
   checkbox.scrollIntoView();
--- a/devtools/client/webconsole/test/browser/browser_webconsole_worker_evaluate.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_worker_evaluate.js
@@ -9,17 +9,17 @@
 const TEST_URI =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-evaluate-worker.html";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await openDebugger();
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const dbg = createDebuggerContext(toolbox);
 
   execute(hud, "pauseInWorker(42)");
 
   await waitForPaused(dbg);
   await openConsole();
 
   await executeAndWaitForMessage(hud, "data", "42", ".result");
--- a/devtools/client/webconsole/test/browser/head.js
+++ b/devtools/client/webconsole/test/browser/head.js
@@ -345,17 +345,17 @@ function hideContextMenu(hud) {
   }
 
   const onPopupHidden = once(popup, "popuphidden");
   popup.hidePopup();
   return onPopupHidden;
 }
 
 function _getContextMenu(hud) {
-  const toolbox = hud.toolbox;
+  const toolbox = gDevTools.getToolbox(hud.target);
   const doc = toolbox ? toolbox.topWindow.document : hud.chromeWindow.document;
   return doc.getElementById("webconsole-menu");
 }
 
 function loadDocument(url, browser = gBrowser.selectedBrowser) {
   BrowserTestUtils.loadURI(browser, url);
   return BrowserTestUtils.browserLoaded(browser);
 }
--- a/devtools/client/webconsole/webconsole-connection-proxy.js
+++ b/devtools/client/webconsole/webconsole-connection-proxy.js
@@ -18,20 +18,29 @@ const PREF_CONNECTION_TIMEOUT = "devtool
 class WebConsoleConnectionProxy {
   /**
    * @constructor
    * @param {WebConsoleUI} webConsoleUI
    *        A WebConsoleUI instance that owns this connection proxy.
    * @param RemoteTarget target
    *        The target that the console will connect to.
    */
-  constructor(webConsoleUI, target) {
+  constructor(webConsoleUI, target, isBrowserConsole, fissionSupport) {
     this.webConsoleUI = webConsoleUI;
     this.target = target;
-    this.fissionSupport = this.webConsoleUI.fissionSupport;
+    this.isBrowserConsole = isBrowserConsole;
+    this.fissionSupport = fissionSupport;
+
+    /**
+     * The DebuggerClient object.
+     *
+     * @see DebuggerClient
+     * @type object
+     */
+    this.client = target.client;
 
     this._connecter = null;
 
     this._onPageError = this._onPageError.bind(this);
     this._onLogMessage = this._onLogMessage.bind(this);
     this._onConsoleAPICall = this._onConsoleAPICall.bind(this);
     this._onNetworkEvent = this._onNetworkEvent.bind(this);
     this._onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
@@ -54,17 +63,16 @@ class WebConsoleConnectionProxy {
     if (this._connecter) {
       return this._connecter;
     }
 
     this.target.on("will-navigate", this._onTabWillNavigate);
     this.target.on("navigate", this._onTabNavigated);
 
     const connection = (async () => {
-      this.client = this.target.client;
       this.webConsoleClient = await this.target.getFront("console");
       this._addWebConsoleClientEventListeners();
       await this._attachConsole();
 
       // There is no way to view response bodies from the Browser Console, so do
       // not waste the memory.
       const saveBodies =
         !this.webConsoleUI.isBrowserConsole &&
@@ -371,13 +379,14 @@ class WebConsoleConnectionProxy {
     }
 
     this._removeWebConsoleClientEventListeners();
     this.target.off("will-navigate", this._onTabWillNavigate);
     this.target.off("navigate", this._onTabNavigated);
 
     this.client = null;
     this.webConsoleClient = null;
+    this.target = null;
     this.webConsoleUI = null;
   }
 }
 
 exports.WebConsoleConnectionProxy = WebConsoleConnectionProxy;
--- a/devtools/client/webconsole/webconsole-ui.js
+++ b/devtools/client/webconsole/webconsole-ui.js
@@ -2,16 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Utils: WebConsoleUtils } = require("devtools/client/webconsole/utils");
 const EventEmitter = require("devtools/shared/event-emitter");
 const Services = require("Services");
+const { gDevTools } = require("devtools/client/framework/devtools");
 const {
   WebConsoleConnectionProxy,
 } = require("devtools/client/webconsole/webconsole-connection-proxy");
 const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
 const { l10n } = require("devtools/client/webconsole/utils/messages");
 
 var ChromeUtils = require("ChromeUtils");
 const { BrowserLoader } = ChromeUtils.import(
@@ -137,31 +138,30 @@ class WebConsoleUI {
       this.jsterm.destroy();
       this.jsterm = null;
     }
 
     if (this.wrapper) {
       this.wrapper.destroy();
     }
 
-    const toolbox = this.hud.toolbox;
+    const toolbox = gDevTools.getToolbox(this.hud.target);
     if (toolbox) {
       toolbox.off("webconsole-selected", this._onPanelSelected);
       toolbox.off("split-console", this._onChangeSplitConsoleState);
       toolbox.off("select", this._onChangeSplitConsoleState);
     }
 
+    this.window = this.hud = this.wrapper = null;
+
     for (const proxy of this.getAllProxies()) {
       proxy.disconnect();
     }
     this.proxy = null;
     this.additionalProxies = null;
-
-    // Nullify `hud` last as it nullify also target which is used on destroy
-    this.window = this.hud = this.wrapper = null;
   }
 
   /**
    * Clear the Web Console output.
    *
    * This method emits the "messages-cleared" notification.
    *
    * @param boolean clearStorage
@@ -217,17 +217,17 @@ class WebConsoleUI {
         },
       },
       true
     );
     return this.wrapper;
   }
 
   logWarningAboutReplacedAPI() {
-    return this.hud.currentTarget.logWarningInPage(
+    return this.hud.target.logWarningInPage(
       l10n.getStr("ConsoleAPIDisabled"),
       "ConsoleAPIDisabled"
     );
   }
 
   /**
    * Setter for saving of network request and response bodies.
    *
@@ -252,57 +252,70 @@ class WebConsoleUI {
   /**
    * Connect to the server using the remote debugging protocol.
    *
    * @private
    * @return object
    *         A promise object that is resolved/reject based on the proxies connections.
    */
   async _initConnection() {
-    this.proxy = new WebConsoleConnectionProxy(this, this.hud.currentTarget);
+    this.proxy = new WebConsoleConnectionProxy(
+      this,
+      this.hud.target,
+      this.isBrowserConsole,
+      this.fissionSupport
+    );
 
-    const target = this.hud.currentTarget;
-    if (this.fissionSupport && target.chrome && !target.isAddon) {
-      const { mainRoot } = target.client;
+    if (
+      this.fissionSupport &&
+      this.hud.target.chrome &&
+      !this.hud.target.isAddon
+    ) {
+      const { mainRoot } = this.hud.target.client;
       const { processes } = await mainRoot.listProcesses();
 
       this.additionalProxies = [];
       for (const processDescriptor of processes) {
         const targetFront = await processDescriptor.getTarget();
 
         // Don't create a proxy for the "main" target,
         // as we already created it in this.proxy.
-        if (targetFront === target) {
+        if (targetFront === this.hud.target) {
           continue;
         }
 
         if (!targetFront) {
           console.warn(
             "Can't retrieve the target front for process",
             processDescriptor
           );
           continue;
         }
 
         this.additionalProxies.push(
-          new WebConsoleConnectionProxy(this, targetFront)
+          new WebConsoleConnectionProxy(
+            this,
+            targetFront,
+            this.isBrowserConsole,
+            this.fissionSupport
+          )
         );
       }
     }
 
     return Promise.all(this.getAllProxies().map(proxy => proxy.connect()));
   }
 
   _initUI() {
     this.document = this.window.document;
     this.rootElement = this.document.documentElement;
 
     this.outputNode = this.document.getElementById("app-wrapper");
 
-    const toolbox = this.hud.toolbox;
+    const toolbox = gDevTools.getToolbox(this.hud.target);
 
     // Initialize module loader and load all the WebConsoleWrapper. The entire code-base
     // doesn't need any extra privileges and runs entirely in content scope.
     const WebConsoleWrapper = BrowserLoader({
       baseURI: "resource://devtools/client/webconsole/",
       window: this.window,
     }).require("./webconsole-wrapper");
 
--- a/devtools/client/webconsole/webconsole-wrapper.js
+++ b/devtools/client/webconsole/webconsole-wrapper.js
@@ -79,19 +79,19 @@ class WebConsoleWrapper {
   }
 
   init() {
     return new Promise(async resolve => {
       const attachRefToWebConsoleUI = (id, node) => {
         this.webConsoleUI[id] = node;
       };
       const { webConsoleUI } = this;
-      const debuggerClient = this.hud.currentTarget.client;
+      const debuggerClient = this.hud.target.client;
 
-      const webConsoleClient = await this.hud.currentTarget.getFront("console");
+      const webConsoleClient = await this.hud.target.getFront("console");
       this.networkDataProvider = new DataProvider({
         actions: {
           updateRequest: (id, data) => {
             return this.batchedRequestUpdates({ id, data });
           },
         },
         webConsoleClient,
       });
@@ -109,33 +109,41 @@ class WebConsoleWrapper {
               },
             ])
           );
         },
         openLink: (url, e) => {
           webConsoleUI.hud.openLink(url, e);
         },
         canRewind: () => {
-          const target = webConsoleUI.hud && webConsoleUI.hud.currentTarget;
-          const traits = target && target.traits;
-          return traits && traits.canRewind;
+          if (
+            !(
+              webConsoleUI.hud &&
+              webConsoleUI.hud.target &&
+              webConsoleUI.hud.target.traits
+            )
+          ) {
+            return false;
+          }
+
+          return webConsoleUI.hud.target.traits.canRewind;
         },
         createElement: nodename => {
           return this.document.createElement(nodename);
         },
         fetchObjectProperties: async (grip, ignoreNonIndexedProperties) => {
-          const client = new ObjectClient(this.hud.currentTarget.client, grip);
+          const client = new ObjectClient(this.hud.target.client, grip);
           const { iterator } = await client.enumProperties({
             ignoreNonIndexedProperties,
           });
           const { ownProperties } = await iterator.slice(0, iterator.count);
           return ownProperties;
         },
         fetchObjectEntries: async grip => {
-          const client = new ObjectClient(this.hud.currentTarget.client, grip);
+          const client = new ObjectClient(this.hud.target.client, grip);
           const { iterator } = await client.enumEntries();
           const { ownProperties } = await iterator.slice(0, iterator.count);
           return ownProperties;
         },
         getLongString: grip => {
           const proxy = webConsoleUI.getProxy();
           return proxy.webConsoleClient.getString(grip);
         },
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -46,55 +46,51 @@ const isMacOS = Services.appinfo.OS === 
  *
  * This object only wraps the iframe that holds the Web Console UI. This is
  * meant to be an integration point between the Firefox UI and the Web Console
  * UI and features.
  */
 class WebConsole {
   /*
    * @constructor
-   * @param object toolbox
-   *        The toolbox where the web console is displayed.
+   * @param object target
+   *        The target that the web console will connect to.
    * @param nsIDOMWindow iframeWindow
    *        The window where the web console UI is already loaded.
    * @param nsIDOMWindow chromeWindow
    *        The window of the web console owner.
    * @param bool isBrowserConsole
    */
   constructor(
-    toolbox,
+    target,
     iframeWindow,
     chromeWindow,
     isBrowserConsole = false,
     fissionSupport = false
   ) {
-    this.toolbox = toolbox;
     this.iframeWindow = iframeWindow;
     this.chromeWindow = chromeWindow;
     this.hudId = "hud_" + ++gHudId;
+    this.target = target;
     this.browserWindow = this.chromeWindow.top;
     this.isBrowserConsole = isBrowserConsole;
     this.fissionSupport = fissionSupport;
 
     const element = this.browserWindow.document.documentElement;
     if (element.getAttribute("windowtype") != gDevTools.chromeWindowType) {
       this.browserWindow = Services.wm.getMostRecentWindow(
         gDevTools.chromeWindowType
       );
     }
     this.ui = new WebConsoleUI(this);
     this._destroyer = null;
 
     EventEmitter.decorate(this);
   }
 
-  get currentTarget() {
-    return this.toolbox.target;
-  }
-
   /**
    * Getter for the window that can provide various utilities that the web
    * console makes use of, like opening links, managing popups, etc.  In
    * most cases, this will be |this.browserWindow|, but in some uses (such as
    * the Browser Toolbox), there is no browser window, so an alternative window
    * hosts the utilities there.
    * @type nsIDOMWindow
    */
@@ -192,17 +188,17 @@ class WebConsole {
    * Manually handle the case where toolbox does not exist (Browser Console).
    *
    * @param string sourceURL
    *        The URL of the file.
    * @param integer sourceLine
    *        The line number which you want to place the caret.
    */
   viewSourceInStyleEditor(sourceURL, sourceLine) {
-    const toolbox = this.toolbox;
+    const toolbox = gDevTools.getToolbox(this.target);
     if (!toolbox) {
       this.viewSource(sourceURL, sourceLine);
       return;
     }
     toolbox.viewSourceInStyleEditor(sourceURL, sourceLine);
   }
 
   /**
@@ -215,17 +211,17 @@ class WebConsole {
    * @param string sourceURL
    *        The URL of the file.
    * @param integer sourceLine
    *        The line number which you want to place the caret.
    * @param integer sourceColumn
    *        The column number which you want to place the caret.
    */
   viewSourceInDebugger(sourceURL, sourceLine, sourceColumn) {
-    const toolbox = this.toolbox;
+    const toolbox = gDevTools.getToolbox(this.target);
     if (!toolbox) {
       this.viewSource(sourceURL, sourceLine, sourceColumn);
       return;
     }
     toolbox
       .viewSourceInDebugger(sourceURL, sourceLine, sourceColumn)
       .then(() => {
         this.ui.emit("source-in-debugger-opened");
@@ -252,17 +248,17 @@ class WebConsole {
    *         An object which holds:
    *         - frames: the active ThreadFront.cachedFrames array.
    *         - selected: depth/index of the selected stackframe in the debugger
    *         UI.
    *         If the debugger is not open or if it's not paused, then |null| is
    *         returned.
    */
   getDebuggerFrames() {
-    const toolbox = this.toolbox;
+    const toolbox = gDevTools.getToolbox(this.target);
     if (!toolbox) {
       return null;
     }
     const panel = toolbox.getPanel("jsdebugger");
 
     if (!panel) {
       return null;
     }
@@ -281,17 +277,17 @@ class WebConsole {
    *          If it can, returns an object containing the following:
    *            - {String} expression: The mapped expression
    *            - {Object} mapped: An object containing the different mapping that could
    *                               be done and if they were applied on the input.
    *                               At the moment, contains `await`, `bindings` and
    *                               `originalExpression`.
    */
   getMappedExpression(expression) {
-    const toolbox = this.toolbox;
+    const toolbox = gDevTools.getToolbox(this.target);
 
     // We need to check if the debugger is open, since it may perform a variable name
     // substitution for sourcemapped script (i.e. evaluated `myVar.trim()` might need to
     // be transformed into `a.trim()`).
     const panel = toolbox && toolbox.getPanel("jsdebugger");
     if (panel) {
       return panel.getMappedExpression(expression);
     }
@@ -336,17 +332,17 @@ class WebConsole {
    *
    * @return object|null
    *         A Selection referring to the currently selected node in the
    *         Inspector.
    *         If the inspector was never opened, or no node was ever selected,
    *         then |null| is returned.
    */
   getInspectorSelection() {
-    const toolbox = this.toolbox;
+    const toolbox = gDevTools.getToolbox(this.target);
     if (!toolbox) {
       return null;
     }
     const panel = toolbox.getPanel("inspector");
     if (!panel || !panel.selection) {
       return null;
     }
     return panel.selection;