Bug 1485676 - Rename TabTarget.makeRemote to TabTarget.attach. r=jdescottes
☠☠ backed out by 99b4f09fa32c ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 18 Sep 2018 02:10:24 -0700
changeset 493539 e63025150c7a16f6881b1332cc1c52e991521c3d
parent 493538 f9ef30ae3f7f21cc8e92f04575a8d9be0bc9c283
child 493540 4de2e71debfe26267375c315074a46dfe3a17791
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1485676
milestone64.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 1485676 - Rename TabTarget.makeRemote to TabTarget.attach. r=jdescottes Summary: Now that all the "remoting" of this method has been moved to TargetFactory.createTargetForTab, we should rename this method to what it does now. It mostly call attach requests of the target actor and its child console actor. It also "connect" the webextension target actor, but I would like to eventually move that outside of TabTarget.attach, like makeRemote. Depends On D4078 Reviewers: yulia! Tags: #secure-revision Bug #: 1485676 Differential Revision: https://phabricator.services.mozilla.com/D6161 MozReview-Commit-ID: KmFi1LIUBga
browser/components/extensions/parent/ext-devtools.js
devtools/client/accessibility/panel.js
devtools/client/application/panel.js
devtools/client/application/test/head.js
devtools/client/canvasdebugger/panel.js
devtools/client/canvasdebugger/test/head.js
devtools/client/debugger/new/panel.js
devtools/client/debugger/panel.js
devtools/client/dom/panel.js
devtools/client/framework/target.js
devtools/client/framework/test/browser_target_events.js
devtools/client/framework/test/browser_target_support.js
devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js
devtools/client/framework/test/browser_toolbox_tool_ready.js
devtools/client/framework/test/browser_toolbox_window_reload_target.js
devtools/client/framework/toolbox-options.js
devtools/client/framework/toolbox.js
devtools/client/inspector/inspector.js
devtools/client/menus.js
devtools/client/netmonitor/panel.js
devtools/client/netmonitor/src/api.js
devtools/client/netmonitor/src/har/har-automation.js
devtools/client/netmonitor/test/head.js
devtools/client/performance/test/helpers/panel-utils.js
devtools/client/scratchpad/scratchpad.js
devtools/client/shadereditor/panel.js
devtools/client/shadereditor/test/head.js
devtools/client/shared/test/shared-head.js
devtools/client/sourceeditor/test/browser_css_autocompletion.js
devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
devtools/client/storage/panel.js
devtools/client/styleeditor/panel.js
devtools/client/webaudioeditor/panel.js
devtools/client/webaudioeditor/test/head.js
devtools/client/webconsole/panel.js
devtools/server/tests/mochitest/test_framerate_04.html
devtools/shared/fronts/csscoverage.js
dom/security/test/cors/head.js
dom/security/test/general/browser_test_FTP_console_warning.js
--- a/browser/components/extensions/parent/ext-devtools.js
+++ b/browser/components/extensions/parent/ext-devtools.js
@@ -30,31 +30,31 @@ function getDevToolsPrefBranchName(exten
  * @param {DevToolsExtensionPageContextParent} context
  *   A devtools extension proxy context.
  *
  * @returns {Promise<TabTarget>}
  *   The cloned devtools target associated to the context.
  */
 global.getDevToolsTargetForContext = async (context) => {
   if (context.devToolsTarget) {
-    await context.devToolsTarget.makeRemote();
+    await context.devToolsTarget.attach();
     return context.devToolsTarget;
   }
 
   if (!context.devToolsToolbox || !context.devToolsToolbox.target) {
     throw new Error("Unable to get a TabTarget for a context not associated to any toolbox");
   }
 
   if (!context.devToolsToolbox.target.isLocalTab) {
     throw new Error("Unexpected target type: only local tabs are currently supported.");
   }
 
   const tab = context.devToolsToolbox.target.tab;
   context.devToolsTarget = await DevToolsShim.createTargetForTab(tab);
-  await context.devToolsTarget.makeRemote();
+  await context.devToolsTarget.attach();
 
   return context.devToolsTarget;
 };
 
 /**
  * Retrieve the devtools target for the devtools extension proxy context
  * (lazily cloned from the target of the toolbox associated to the context
  * the first time that it is accessed).
--- a/devtools/client/accessibility/panel.js
+++ b/devtools/client/accessibility/panel.js
@@ -56,17 +56,17 @@ AccessibilityPanel.prototype = {
 
     let resolver;
     this._opening = new Promise(resolve => {
       resolver = resolve;
     });
 
     // Local monitoring needs to make the target remote.
     if (!this.target.isRemote) {
-      await this.target.makeRemote();
+      await this.target.attach();
     }
 
     this._telemetry = new Telemetry();
     this.panelWin.gTelemetry = this._telemetry;
 
     this.target.on("navigate", this.onTabNavigated);
     this._toolbox.on("select", this.onPanelVisibilityChange);
 
--- a/devtools/client/application/panel.js
+++ b/devtools/client/application/panel.js
@@ -19,17 +19,17 @@ class ApplicationPanel {
    */
   constructor(panelWin, toolbox) {
     this.panelWin = panelWin;
     this.toolbox = toolbox;
   }
 
   async open() {
     if (!this.toolbox.target.isRemote) {
-      await this.toolbox.target.makeRemote();
+      await this.toolbox.target.attach();
     }
 
     await this.panelWin.Application.bootstrap({
       toolbox: this.toolbox,
       panel: this,
     });
 
     this.emit("ready");
--- a/devtools/client/application/test/head.js
+++ b/devtools/client/application/test/head.js
@@ -43,17 +43,17 @@ function getWorkerContainers(doc) {
 function navigate(target, url, waitForTargetEvent = "navigate") {
   executeSoon(() => target.activeTab.navigateTo(url));
   return once(target, waitForTargetEvent);
 }
 
 async function openNewTabAndApplicationPanel(url) {
   const tab = await addTab(url);
   const target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   const toolbox = await gDevTools.showToolbox(target, "application");
   const panel = toolbox.getCurrentPanel();
   return { panel, tab, target, toolbox };
 }
 
 async function unregisterAllWorkers(client) {
   info("Wait until all workers have a valid registrationActor");
--- a/devtools/client/canvasdebugger/panel.js
+++ b/devtools/client/canvasdebugger/panel.js
@@ -27,17 +27,17 @@ CanvasDebuggerPanel.prototype = {
    * @return object
    *         A promise that is resolved when the Canvas Debugger completes opening.
    */
   open: function() {
     let targetPromise;
 
     // Local debugging needs to make the target remote.
     if (!this.target.isRemote) {
-      targetPromise = this.target.makeRemote();
+      targetPromise = this.target.attach();
     } else {
       targetPromise = Promise.resolve(this.target);
     }
 
     return targetPromise
       .then(() => {
         this.panelWin.gToolbox = this._toolbox;
         this.panelWin.gTarget = this.target;
--- a/devtools/client/canvasdebugger/test/head.js
+++ b/devtools/client/canvasdebugger/test/head.js
@@ -130,45 +130,46 @@ function initCallWatcherBackend(aUrl) {
 
     await registerActorInContentProcess("chrome://mochitests/content/browser/devtools/client/canvasdebugger/test/call-watcher-actor.js", {
       prefix: "callWatcher",
       constructor: "CallWatcherActor",
       type: { target: true }
     });
 
     const target = await TargetFactory.forTab(tab);
-    await target.makeRemote();
+    await target.attach();
+
     const front = new CallWatcherFront(target.client, target.form);
     return { target, front };
   })();
 }
 
 function initCanvasDebuggerBackend(aUrl) {
   info("Initializing a canvas debugger front.");
   initServer();
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     const front = new CanvasFront(target.client, target.form);
     return { target, front };
   })();
 }
 
 function initCanvasDebuggerFrontend(aUrl) {
   info("Initializing a canvas debugger pane.");
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", true);
     const toolbox = await gDevTools.showToolbox(target, "canvasdebugger");
     const panel = toolbox.getCurrentPanel();
     return { target, panel };
   })();
 }
 
--- a/devtools/client/debugger/new/panel.js
+++ b/devtools/client/debugger/new/panel.js
@@ -17,17 +17,17 @@ function DebuggerPanel(iframeWindow, too
   this.panelWin = iframeWindow;
   this.panelWin.L10N = L10N;
   this.toolbox = toolbox;
 }
 
 DebuggerPanel.prototype = {
   open: async function() {
     if (!this.toolbox.target.isRemote) {
-      await this.toolbox.target.makeRemote();
+      await this.toolbox.target.attach();
     }
 
     const {
       actions,
       store,
       selectors,
       client
     } = await this.panelWin.Debugger.bootstrap({
--- a/devtools/client/debugger/panel.js
+++ b/devtools/client/debugger/panel.js
@@ -34,17 +34,17 @@ DebuggerPanel.prototype = {
    * @return object
    *         A promise that is resolved when the Debugger completes opening.
    */
   open: function () {
     let targetPromise;
 
     // Local debugging needs to make the target remote.
     if (!this.target.isRemote) {
-      targetPromise = this.target.makeRemote();
+      targetPromise = this.target.attach();
       // Listen for tab switching events to manage focus when the content window
       // is paused and events suppressed.
       this.target.tab.addEventListener("TabSelect", this);
     } else {
       targetPromise = promise.resolve(this.target);
     }
 
     return targetPromise
--- a/devtools/client/dom/panel.js
+++ b/devtools/client/dom/panel.js
@@ -41,17 +41,17 @@ DomPanel.prototype = {
       return this._opening;
     }
 
     const deferred = defer();
     this._opening = deferred.promise;
 
     // Local monitoring needs to make the target remote.
     if (!this.target.isRemote) {
-      await this.target.makeRemote();
+      await this.target.attach();
     }
 
     this.initialize();
 
     this.isReady = true;
     this.emit("ready");
     deferred.resolve(this);
 
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -40,17 +40,23 @@ const TargetFactory = exports.TargetFact
     targets.set(tab, promise);
     target = await promise;
     // Then replace the promise with the target object
     targets.set(tab, target);
     return target;
   },
 
   /**
-   * Constructor a target for the given tab.
+   * Instantiate a target for the given tab.
+   *
+   * This will automatically:
+   * - spawn a DebuggerServer in the parent process,
+   * - create a DebuggerClient and connect it to this local DebuggerServer,
+   * - call RootActor's `getTab` request to retrieve the FrameTargetActor's form,
+   * - instantiate a TabTarget instance.
    *
    * @param {XULTab} tab
    *        The tab to use in creating a new target.
    *
    * @return A target object
    */
   async createTargetForTab(tab) {
     function createLocalServer() {
@@ -104,17 +110,17 @@ const TargetFactory = exports.TargetFact
    *        }
    *
    * @return A promise of a target object
    */
   forRemoteTab: function(options) {
     let targetPromise = promiseTargets.get(options);
     if (targetPromise == null) {
       const target = new TabTarget(options);
-      targetPromise = target.makeRemote().then(() => target);
+      targetPromise = target.attach().then(() => target);
       promiseTargets.set(options, targetPromise);
     }
     return targetPromise;
   },
 
   forWorker: function(workerClient) {
     let target = targets.get(workerClient);
     if (target == null) {
@@ -451,87 +457,78 @@ TabTarget.prototype = {
   get contentPrincipal() {
     if (!this.isLocalTab) {
       return null;
     }
     return this.tab.linkedBrowser.contentPrincipal;
   },
 
   /**
-   * Adds remote protocol capabilities to the target, so that it can be used
-   * for tools that support the Remote Debugging Protocol even for local
-   * connections.
+   * Attach the target and its console actor.
+   *
+   * This method will mainly call `attach` request on the target actor as well
+   * as the console actor.
+   * For webextension, it also preliminary converts addonTargetActor to a
+   * WebExtensionTargetActor.
    */
-  makeRemote: async function() {
-    if (this._remote) {
-      return this._remote;
-    }
-
-    if (this._form.isWebExtension &&
-        this.client.mainRoot.traits.webExtensionAddonConnect) {
-      // The addonTargetActor form is related to a WebExtensionActor instance,
-      // which isn't a target actor on its own, it is an actor living in the parent
-      // process with access to the addon metadata, it can control the addon (e.g.
-      // reloading it) and listen to the AddonManager events related to the lifecycle of
-      // the addon (e.g. when the addon is disabled or uninstalled).
-      // To retrieve the target actor instance, we call its "connect" method, (which
-      // fetches the target actor form from a WebExtensionTargetActor instance).
-      const {form} = await this._client.request({
-        to: this._form.actor, type: "connect",
-      });
-
-      this._form = form;
-      this._url = form.url;
-      this._title = form.title;
+  attach() {
+    if (this._attach) {
+      return this._attach;
     }
 
-    this._setupRemoteListeners();
+    // Attach the target actor
+    const attachTarget = async () => {
+      const [response, tabClient] = await this._client.attachTab(this._form.actor);
+      this.activeTab = tabClient;
+      this.threadActor = response.threadActor;
+    };
 
-    this._remote = new Promise((resolve, reject) => {
-      const attachTab = async () => {
-        try {
-          const [response, tabClient] = await this._client.attachTab(this._form.actor);
-          this.activeTab = tabClient;
-          this.threadActor = response.threadActor;
-        } catch (e) {
-          reject("Unable to attach to the tab: " + e);
-          return;
-        }
-        attachConsole();
-      };
+    // Attach the console actor
+    const attachConsole = async () => {
+      const [, consoleClient] = await this._client.attachConsole(
+        this._form.consoleActor, []);
+      this.activeConsole = consoleClient;
 
-      const onConsoleAttached = ([response, consoleClient]) => {
-        this.activeConsole = consoleClient;
-
-        this._onInspectObject = packet => this.emit("inspect-object", packet);
-        this.activeConsole.on("inspectObject", this._onInspectObject);
+      this._onInspectObject = packet => this.emit("inspect-object", packet);
+      this.activeConsole.on("inspectObject", this._onInspectObject);
+    };
 
-        resolve(null);
-      };
+    this._attach = (async () => {
+      if (this._form.isWebExtension &&
+          this.client.mainRoot.traits.webExtensionAddonConnect) {
+        // The addonTargetActor form is related to a WebExtensionActor instance,
+        // which isn't a target actor on its own, it is an actor living in the parent
+        // process with access to the addon metadata, it can control the addon (e.g.
+        // reloading it) and listen to the AddonManager events related to the lifecycle of
+        // the addon (e.g. when the addon is disabled or uninstalled).
+        // To retrieve the target actor instance, we call its "connect" method, (which
+        // fetches the target actor form from a WebExtensionTargetActor instance).
+        const {form} = await this._client.request({
+          to: this._form.actor, type: "connect",
+        });
 
-      const attachConsole = () => {
-        this._client.attachConsole(this._form.consoleActor, [])
-          .then(onConsoleAttached, response => {
-            reject(
-              `Unable to attach to the console [${response.error}]: ${response.message}`);
-          });
-      };
+        this._form = form;
+        this._url = form.url;
+        this._title = form.title;
+      }
 
+      this._setupRemoteListeners();
+
+      // AddonActor and chrome debugging on RootActor don't inherit from
+      // BrowsingContextTargetActor (i.e. this.isBrowsingContext=false) and don't need
+      // to be attached.
       if (this.isBrowsingContext) {
-        // In the remote debugging case, the protocol connection will have been
-        // already initialized in the connection screen code.
-        attachTab();
-      } else {
-        // AddonActor and chrome debugging on RootActor doesn't inherit from
-        // BrowsingContextTargetActor and doesn't need to be attached.
-        attachConsole();
+        await attachTarget();
       }
-    });
 
-    return this._remote;
+      // But all target actor have a console actor to attach
+      return attachConsole();
+    })();
+
+    return this._attach;
   },
 
   /**
    * Listen to the different events.
    */
   _setupListeners: function() {
     this.tab.addEventListener("TabClose", this);
     this.tab.ownerDocument.defaultView.addEventListener("unload", this);
@@ -726,17 +723,17 @@ TabTarget.prototype = {
       promiseTargets.delete(this._form);
     }
 
     this.activeTab = null;
     this.activeConsole = null;
     this._client = null;
     this._tab = null;
     this._form = null;
-    this._remote = null;
+    this._attach = null;
     this._root = null;
     this._title = null;
     this._url = null;
     this.threadActor = null;
   },
 
   toString: function() {
     const id = this._tab ? this._tab : (this._form && this._form.actor);
@@ -840,17 +837,17 @@ WorkerTarget.prototype = {
     }
     return false;
   },
 
   getTrait: function() {
     return undefined;
   },
 
-  makeRemote: function() {
+  attach: function() {
     return Promise.resolve();
   },
 
   logErrorInPage: function() {
     // No-op.  See bug 1368680.
   },
 
   logWarningInPage: function() {
--- a/devtools/client/framework/test/browser_target_events.js
+++ b/devtools/client/framework/test/browser_target_events.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 add_task(async function() {
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
 
   const target = await TargetFactory.forTab(gBrowser.selectedTab);
-  await target.makeRemote();
+  await target.attach();
   is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
 
   const willNavigate = once(target, "will-navigate");
   const navigate = once(target, "navigate");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     content.location = "data:text/html,<meta charset='utf8'/>test navigation";
   });
   await willNavigate;
--- a/devtools/client/framework/test/browser_target_support.js
+++ b/devtools/client/framework/test/browser_target_support.js
@@ -5,17 +5,17 @@
 
 // Test support methods on Target, such as `hasActor`, `getActorDescription`,
 // `actorHasMethod` and `getTrait`.
 
 var { WebAudioFront } =
   require("devtools/shared/fronts/webaudio");
 
 async function testTarget(client, target) {
-  await target.makeRemote();
+  await target.attach();
 
   is(target.hasActor("timeline"), true, "target.hasActor() true when actor exists.");
   is(target.hasActor("webaudio"), true, "target.hasActor() true when actor exists.");
   is(target.hasActor("notreal"), false, "target.hasActor() false when actor does not exist.");
   // Create a front to ensure the actor is loaded
   new WebAudioFront(target.client, target.form);
 
   let desc = await target.getActorDescription("webaudio");
--- a/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js
+++ b/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js
@@ -10,17 +10,17 @@ requestLongerTimeout(2);
 var {Toolbox} = require("devtools/client/framework/toolbox");
 
 const {LocalizationHelper} = require("devtools/shared/l10n");
 const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
 
 add_task(async function() {
   const tab = await addTab("about:blank");
   const target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   const toolIDs = gDevTools.getToolDefinitionArray()
                          .filter(
                            def =>
                              def.isTargetSupported(target) &&
                              def.id !== "options"
                          )
                          .map(def => def.id);
--- a/devtools/client/framework/test/browser_toolbox_tool_ready.js
+++ b/devtools/client/framework/test/browser_toolbox_tool_ready.js
@@ -30,15 +30,15 @@ function performChecks(target) {
   })();
 }
 
 function test() {
   (async function() {
     toggleAllTools(true);
     const tab = await addTab("about:blank");
     const target = await TargetFactory.forTab(tab);
-    await target.makeRemote();
+    await target.attach();
     await performChecks(target);
     gBrowser.removeCurrentTab();
     toggleAllTools(false);
     finish();
   })();
 }
--- a/devtools/client/framework/test/browser_toolbox_window_reload_target.js
+++ b/devtools/client/framework/test/browser_toolbox_window_reload_target.js
@@ -15,17 +15,17 @@ const {LocalizationHelper} = require("de
 const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
 
 var target, toolbox, description, reloadsSent, toolIDs;
 
 function test() {
   addTab(TEST_URL).then(async () => {
     target = await TargetFactory.forTab(gBrowser.selectedTab);
 
-    target.makeRemote().then(() => {
+    target.attach().then(() => {
       toolIDs = gDevTools.getToolDefinitionArray()
                   .filter(def => def.isTargetSupported(target))
                   .map(def => def.id);
       gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.BOTTOM)
                .then(startReloadTest);
     });
   });
 }
--- a/devtools/client/framework/toolbox-options.js
+++ b/devtools/client/framework/toolbox-options.js
@@ -79,17 +79,17 @@ OptionsPanel.prototype = {
 
   get target() {
     return this.toolbox.target;
   },
 
   async open() {
     // For local debugging we need to make the target remote.
     if (!this.target.isRemote) {
-      await this.target.makeRemote();
+      await this.target.attach();
     }
 
     this.setupToolsList();
     this.setupToolbarButtonsList();
     this.setupThemeList();
     this.setupNightlyOptions();
     await this.populatePreferences();
     this.isReady = true;
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -442,17 +442,17 @@ Toolbox.prototype = {
           resolve();
         }, this._URL);
       });
 
       // Optimization: fire up a few other things before waiting on
       // the iframe being ready (makes startup faster)
 
       // Load the toolbox-level actor fronts and utilities now
-      await this._target.makeRemote();
+      await this._target.attach();
 
       // Start tracking network activity on toolbox open for targets such as tabs.
       // (Workers and potentially others don't manage the console client in the target.)
       if (this._target.activeConsole) {
         await this._target.activeConsole.startListeners([
           "NetworkActivity",
         ]);
       }
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -167,17 +167,17 @@ Inspector.prototype = {
   /**
    * open is effectively an asynchronous constructor
    */
   async init() {
     // Localize all the nodes containing a data-localization attribute.
     localizeMarkup(this.panelDoc);
 
     this._cssProperties = await initCssProperties(this.toolbox);
-    await this.target.makeRemote();
+    await this.target.attach();
     await this._getPageStyle();
 
     // This may throw if the document is still loading and we are
     // refering to a dead about:blank document
     const defaultSelection = await this._getDefaultNodeForSelection()
       .catch(this._handleRejectionIfNotDestroyed);
 
     return this._deferredOpen(defaultSelection);
--- a/devtools/client/menus.js
+++ b/devtools/client/menus.js
@@ -97,17 +97,17 @@ exports.menuitems = [
     keyId: "responsiveDesignMode",
     checkbox: true
   },
   { id: "menu_eyedropper",
     l10nKey: "eyedropper",
     async oncommand(event) {
       const window = event.target.ownerDocument.defaultView;
       const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
-      await target.makeRemote();
+      await target.attach();
       const inspectorFront = await target.getFront("inspector");
       inspectorFront.pickColorFromPage({copyOnSelect: true, fromMenu: true});
     },
     checkbox: true
   },
   { id: "menu_scratchpad",
     l10nKey: "scratchpad",
     oncommand() {
--- a/devtools/client/netmonitor/panel.js
+++ b/devtools/client/netmonitor/panel.js
@@ -7,17 +7,17 @@
 function NetMonitorPanel(iframeWindow, toolbox) {
   this.panelWin = iframeWindow;
   this.toolbox = toolbox;
 }
 
 NetMonitorPanel.prototype = {
   async open() {
     if (!this.toolbox.target.isRemote) {
-      await this.toolbox.target.makeRemote();
+      await this.toolbox.target.attach();
     }
 
     // Reuse an existing Network monitor API object if available.
     // It could have been created for WE API before Net panel opens.
     const api = await this.toolbox.getNetMonitorAPI();
     const app = this.panelWin.initialize(api);
 
     // Connect the application object to the UI.
--- a/devtools/client/netmonitor/src/api.js
+++ b/devtools/client/netmonitor/src/api.js
@@ -90,17 +90,17 @@ NetMonitorAPI.prototype = {
    * Connect to the Firefox backend by default.
    *
    * As soon as connections to different back-ends is supported
    * this function should be responsible for picking the right API.
    */
   async connectBackend(connector, connection, actions, getState) {
     // The connection might happen during Toolbox initialization
     // so make sure the target is ready.
-    await connection.tabConnection.tabTarget.makeRemote();
+    await connection.tabConnection.tabTarget.attach();
     return connector.connectFirefox(connection, actions, getState);
   },
 
   // HAR
 
   /**
    * Support for `devtools.network.getHAR` (get collected data as HAR)
    */
--- a/devtools/client/netmonitor/src/har/har-automation.js
+++ b/devtools/client/netmonitor/src/har/har-automation.js
@@ -40,17 +40,17 @@ function HarAutomation(toolbox) {
 
 HarAutomation.prototype = {
   // Initialization
 
   initialize: function(toolbox) {
     this.toolbox = toolbox;
 
     const target = toolbox.target;
-    target.makeRemote().then(() => {
+    target.attach().then(() => {
       this.startMonitoring(target.client, target.form);
     });
   },
 
   destroy: function() {
     if (this.collector) {
       this.collector.stop();
     }
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -286,17 +286,17 @@ function initNetMonitor(url, enableCache
   info("Initializing a network monitor pane.");
 
   return (async function() {
     const tab = await addTab(url);
     info("Net tab added successfully: " + url);
 
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
     info("Target remoted.");
 
     const toolbox = await gDevTools.showToolbox(target, "netmonitor");
     info("Network monitor pane shown successfully.");
 
     const monitor = toolbox.getCurrentPanel();
 
     startNetworkEventUpdateObserver(monitor.panelWin);
--- a/devtools/client/performance/test/helpers/panel-utils.js
+++ b/devtools/client/performance/test/helpers/panel-utils.js
@@ -19,17 +19,17 @@ exports.initPanelInNewTab = async functi
 
 /**
  * Initializes a toolbox panel in the specified tab.
  */
 exports.initPanelInTab = async function({ tool, tab }) {
   dump(`Initializing a ${tool} panel.\n`);
 
   const target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   // Open a toolbox and wait for the connection to the performance actors
   // to be opened. This is necessary because of the WebConsole's
   // `profile` and `profileEnd` methods.
   const toolbox = await gDevTools.showToolbox(target, tool);
   await toolbox.initPerformance();
 
   const panel = toolbox.getCurrentPanel();
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -594,17 +594,17 @@ var Scratchpad = {
                     .GetStringFromName("scratchpadContext.invalid"));
       return;
     }
 
     const target = await TargetFactory.forTab(this.gBrowser.selectedTab);
     target.once("navigate", () => {
       this.run().then(results => deferred.resolve(results));
     });
-    target.makeRemote().then(() => target.activeTab.reload());
+    target.attach().then(() => target.activeTab.reload());
 
     return deferred.promise;
   },
 
   /**
    * Execute the selected text (if any) or the entire editor content in the
    * current context. The evaluation result is inserted into the editor after
    * the selected text, or at the end of the editor content if there is no
@@ -2094,17 +2094,17 @@ ScratchpadTab.prototype = {
    */
   _attach: async function ST__attach(aSubject) {
     const target = await TargetFactory.forTab(this._tab);
     target.once("close", () => {
       if (scratchpadTargets) {
         scratchpadTargets.delete(aSubject);
       }
     });
-    return target.makeRemote().then(() => target);
+    return target.attach().then(() => target);
   },
 };
 
 /**
  * Represents the DebuggerClient connection to a specific window as used by the
  * Scratchpad.
  */
 function ScratchpadWindow() {}
@@ -2138,17 +2138,17 @@ function ScratchpadTarget(aTarget) {
 
 ScratchpadTarget.consoleFor = ScratchpadTab.consoleFor;
 
 ScratchpadTarget.prototype = extend(ScratchpadTab.prototype, {
   _attach: function ST__attach() {
     if (this._target.isRemote) {
       return promise.resolve(this._target);
     }
-    return this._target.makeRemote().then(() => this._target);
+    return this._target.attach().then(() => this._target);
   }
 });
 
 /**
  * Encapsulates management of the sidebar containing the VariablesView for
  * object inspection.
  */
 function ScratchpadSidebar(aScratchpad) {
--- a/devtools/client/shadereditor/panel.js
+++ b/devtools/client/shadereditor/panel.js
@@ -31,17 +31,17 @@ ShaderEditorPanel.prototype = {
    * Open is effectively an asynchronous constructor.
    *
    * @return object
    *         A promise that is resolved when the Shader Editor completes opening.
    */
   async open() {
     // Local debugging needs to make the target remote.
     if (!this.target.isRemote) {
-      await this.target.makeRemote();
+      await this.target.attach();
     }
 
     this.front = new WebGLFront(this.target.client, this.target.form);
     this.shadersListView = new ShadersListView();
     this.eventsHandler = new EventsHandler();
     this.shadersEditorsView = new ShadersEditorsView();
     await this.shadersListView.initialize(this._toolbox, this.shadersEditorsView);
     await this.eventsHandler.initialize(this, this._toolbox, this.target, this.front,
--- a/devtools/client/shadereditor/test/head.js
+++ b/devtools/client/shadereditor/test/head.js
@@ -149,31 +149,31 @@ function initBackend(aUrl) {
 
   DebuggerServer.init();
   DebuggerServer.registerAllActors();
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     const front = new WebGLFront(target.client, target.form);
     return { target, front };
   })();
 }
 
 function initShaderEditor(aUrl) {
   info("Initializing a shader editor pane.");
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     Services.prefs.setBoolPref("devtools.shadereditor.enabled", true);
     const toolbox = await gDevTools.showToolbox(target, "shadereditor");
     const panel = toolbox.getCurrentPanel();
     return { target, panel };
   })();
 }
 
--- a/devtools/client/shared/test/shared-head.js
+++ b/devtools/client/shared/test/shared-head.js
@@ -404,17 +404,17 @@ function wait(ms) {
  * @param {String} hostType Optional. The type of toolbox host to be used.
  * @return {Promise} Resolves with the toolbox, when it has been opened.
  */
 var openToolboxForTab = async function(tab, toolId, hostType) {
   info("Opening the toolbox");
 
   let toolbox;
   const target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   // Check if the toolbox is already loaded.
   toolbox = gDevTools.getToolbox(target);
   if (toolbox) {
     if (!toolId || (toolId && toolbox.getPanel(toolId))) {
       info("Toolbox is already opened");
       return toolbox;
     }
--- a/devtools/client/sourceeditor/test/browser_css_autocompletion.js
+++ b/devtools/client/sourceeditor/test/browser_css_autocompletion.js
@@ -80,17 +80,17 @@ add_task(async function test() {
   browser = tab.linkedBrowser;
   await runTests();
   browser = null;
   gBrowser.removeCurrentTab();
 });
 
 async function runTests() {
   const target = await TargetFactory.forTab(gBrowser.selectedTab);
-  await target.makeRemote();
+  await target.attach();
   inspector = InspectorFront(target.client, target.form);
   const walker = await inspector.getWalker();
   completer = new CSSCompleter({walker: walker,
                                 cssProperties: getClientCssProperties()});
   await checkStateAndMoveOn();
   await completer.walker.release();
   inspector.destroy();
   inspector = null;
--- a/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
+++ b/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
@@ -10,17 +10,17 @@ const TEST_URI = "data:text/html;charset
 
 add_task(async function() {
   await addTab(TEST_URI);
   await runTests();
 });
 
 async function runTests() {
   const target = await TargetFactory.forTab(gBrowser.selectedTab);
-  await target.makeRemote();
+  await target.attach();
   const inspector = InspectorFront(target.client, target.form);
   const walker = await inspector.getWalker();
   const {ed, win, edWin} = await setup(null, {
     autocomplete: true,
     mode: Editor.modes.css,
     autocompleteOpts: {walker: walker, cssProperties: getClientCssProperties()}
   });
   await testMouse(ed, edWin);
--- a/devtools/client/storage/panel.js
+++ b/devtools/client/storage/panel.js
@@ -34,17 +34,17 @@ class StoragePanel {
 
   /**
    * open is effectively an asynchronous constructor
    */
   open() {
     let targetPromise;
     // We always interact with the target as if it were remote
     if (!this.target.isRemote) {
-      targetPromise = this.target.makeRemote();
+      targetPromise = this.target.attach();
     } else {
       targetPromise = Promise.resolve(this.target);
     }
 
     return targetPromise.then(() => {
       this.target.on("close", this.destroy);
       this._front = new StorageFront(this.target.client, this.target.form);
 
--- a/devtools/client/styleeditor/panel.js
+++ b/devtools/client/styleeditor/panel.js
@@ -37,17 +37,17 @@ StyleEditorPanel.prototype = {
   },
 
   /**
    * open is effectively an asynchronous constructor
    */
   async open() {
     // We always interact with the target as if it were remote
     if (!this.target.isRemote) {
-      await this.target.makeRemote();
+      await this.target.attach();
     }
 
     this.target.on("close", this.destroy);
 
     this._debuggee = await this._target.getFront("stylesheets");
 
     // Initialize the CSS properties database.
     const {cssProperties} = await initCssProperties(this._toolbox);
--- a/devtools/client/webaudioeditor/panel.js
+++ b/devtools/client/webaudioeditor/panel.js
@@ -20,17 +20,17 @@ function WebAudioEditorPanel(iframeWindo
 exports.WebAudioEditorPanel = WebAudioEditorPanel;
 
 WebAudioEditorPanel.prototype = {
   open: function() {
     let targetPromise;
 
     // Local debugging needs to make the target remote.
     if (!this.target.isRemote) {
-      targetPromise = this.target.makeRemote();
+      targetPromise = this.target.attach();
     } else {
       targetPromise = Promise.resolve(this.target);
     }
 
     return targetPromise
       .then(() => {
         this.panelWin.gToolbox = this._toolbox;
         this.panelWin.gTarget = this.target;
--- a/devtools/client/webaudioeditor/test/head.js
+++ b/devtools/client/webaudioeditor/test/head.js
@@ -61,17 +61,17 @@ function initBackend(aUrl) {
 
   DebuggerServer.init();
   DebuggerServer.registerAllActors();
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     const front = new WebAudioFront(target.client, target.form);
     return { target, front };
   })();
 }
 
 /**
  * Adds a new tab, and open the toolbox for that tab, selecting the audio editor
@@ -80,17 +80,17 @@ function initBackend(aUrl) {
  */
 function initWebAudioEditor(aUrl) {
   info("Initializing a web audio editor pane.");
 
   return (async function() {
     const tab = await addTab(aUrl);
     const target = await TargetFactory.forTab(tab);
 
-    await target.makeRemote();
+    await target.attach();
 
     Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true);
     const toolbox = await gDevTools.showToolbox(target, "webaudioeditor");
     const panel = toolbox.getCurrentPanel();
     return { target, panel, toolbox };
   })();
 }
 
--- a/devtools/client/webconsole/panel.js
+++ b/devtools/client/webconsole/panel.js
@@ -49,17 +49,17 @@ WebConsolePanel.prototype = {
       if (!doc || doc.readyState !== "complete") {
         await new Promise(resolve => {
           iframe.addEventListener("load", resolve, {capture: true, once: true});
         });
       }
 
       // Local debugging needs to make the target remote.
       if (!this.target.isRemote) {
-        await this.target.makeRemote();
+        await this.target.attach();
       }
 
       const webConsoleUIWindow = iframe.contentWindow.wrappedJSObject;
       const chromeWindow = iframe.ownerDocument.defaultView;
 
       // Open the Web Console.
       this.hud = await HUDService.openWebConsole(
         this.target, webConsoleUIWindow, chromeWindow);
--- a/devtools/server/tests/mochitest/test_framerate_04.html
+++ b/devtools/server/tests/mochitest/test_framerate_04.html
@@ -24,17 +24,17 @@ window.onload = function() {
   attachURL(url, onTab);
 
   async function onTab(_, client, form, contentDoc) {
     const contentWin = contentDoc.defaultView;
     const chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
     const selectedTab = chromeWin.gBrowser.selectedTab;
 
     const target = await TargetFactory.forTab(selectedTab);
-    await target.makeRemote();
+    await target.attach();
     const front = FramerateFront(client, form);
 
     front.startRecording().then(() => {
       window.setTimeout(() => {
         front.getPendingTicks().then(firstBatch => {
           /* eslint-disable max-nested-callbacks */
           target.once("will-navigate", () => {
             window.setTimeout(() => {
--- a/devtools/shared/fronts/csscoverage.js
+++ b/devtools/shared/fronts/csscoverage.js
@@ -105,21 +105,21 @@ const CSSUsageFront = protocol.FrontClas
 });
 
 exports.CSSUsageFront = CSSUsageFront;
 
 const knownFronts = new WeakMap();
 
 /**
  * Create a CSSUsageFront only when needed (returns a promise)
- * For notes on target.makeRemote(), see
+ * For notes on target.attach(), see
  * https://bugzilla.mozilla.org/show_bug.cgi?id=1016330#c7
  */
 exports.getUsage = function(trgt) {
-  return trgt.makeRemote().then(() => {
+  return trgt.attach().then(() => {
     let front = knownFronts.get(trgt.client);
     if (front == null && trgt.form.cssUsageActor != null) {
       front = new CSSUsageFront(trgt.client, trgt.form);
       knownFronts.set(trgt.client, front);
     }
     return front;
   });
 };
--- a/dom/security/test/cors/head.js
+++ b/dom/security/test/cors/head.js
@@ -19,17 +19,17 @@ let promise = require("promise");
  * @param {String} hostType Optional. The type of toolbox host to be used.
  * @return {Promise} Resolves with the toolbox, when it has been opened.
  */
 var openToolboxForTab = async function(tab, toolId, hostType) {
   info("Opening the toolbox");
 
   let toolbox;
   let target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   // Check if the toolbox is already loaded.
   toolbox = gDevTools.getToolbox(target);
   if (toolbox) {
     if (!toolId || (toolId && toolbox.getPanel(toolId))) {
       info("Toolbox is already opened");
       return toolbox;
     }
--- a/dom/security/test/general/browser_test_FTP_console_warning.js
+++ b/dom/security/test/general/browser_test_FTP_console_warning.js
@@ -21,17 +21,17 @@ let promise = require("promise");
  * @param {String} hostType Optional. The type of toolbox host to be used.
  * @return {Promise} Resolves with the toolbox, when it has been opened.
  */
 var openToolboxForTab = async function(tab, toolId, hostType) {
   info("Opening the toolbox");
 
   let toolbox;
   let target = await TargetFactory.forTab(tab);
-  await target.makeRemote();
+  await target.attach();
 
   // Check if the toolbox is already loaded.
   toolbox = gDevTools.getToolbox(target);
   if (toolbox) {
     if (!toolId || (toolId && toolbox.getPanel(toolId))) {
       info("Toolbox is already opened");
       return toolbox;
     }