Bug 1513565 - Get rid of all target.form usages. r=yulia,nchevobbe
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 18 Dec 2018 23:35:57 +0000
changeset 451301 69c7978b620c3a89b068bcfef8cd69c5c5ada60d
parent 451300 af4a0603c641b9235f94af26106557b5538b38a4
child 451302 835e98747541301ba1beb317a6ea3fcd7dd0b310
push id110646
push userebalazs@mozilla.com
push dateWed, 19 Dec 2018 16:05:18 +0000
treeherdermozilla-inbound@1acd86ad823c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia, nchevobbe
bugs1513565
milestone66.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 1513565 - Get rid of all target.form usages. r=yulia,nchevobbe Depends on D14278 Differential Revision: https://phabricator.services.mozilla.com/D14279
devtools/client/debugger/new/src/client/firefox/commands.js
devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
devtools/client/inspector/shared/reflow-tracker.js
devtools/client/netmonitor/src/har/har-automation.js
devtools/client/webconsole/webconsole-connection-proxy.js
devtools/server/tests/mochitest/test_webextension-addon-debugging-connect.html
--- a/devtools/client/debugger/new/src/client/firefox/commands.js
+++ b/devtools/client/debugger/new/src/client/firefox/commands.js
@@ -258,31 +258,16 @@ function autocomplete(
       input,
       cursor,
       result => resolve(result),
       frameId
     );
   });
 }
 
-function debuggeeCommand(script: Script): ?Promise<void> {
-  tabTarget.activeConsole.evaluateJS(script, () => {}, {});
-
-  if (!debuggerClient) {
-    return;
-  }
-
-  const consoleActor = tabTarget.form.consoleActor;
-  const request = debuggerClient._activeRequests.get(consoleActor);
-  request.emit("json-reply", {});
-  debuggerClient._activeRequests.delete(consoleActor);
-
-  return Promise.resolve();
-}
-
 function navigate(url: string): Promise<*> {
   return tabTarget.activeTab.navigateTo({ url });
 }
 
 function reload(): Promise<*> {
   return tabTarget.activeTab.reload();
 }
 
@@ -449,17 +434,16 @@ const clientCommands = {
   setBreakpoint,
   setXHRBreakpoint,
   removeXHRBreakpoint,
   removeBreakpoint,
   setBreakpointCondition,
   evaluate,
   evaluateInFrame,
   evaluateExpressions,
-  debuggeeCommand,
   navigate,
   reload,
   getProperties,
   getFrameScopes,
   pauseOnExceptions,
   prettyPrint,
   disablePrettyPrint,
   fetchSources,
--- a/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
+++ b/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
@@ -119,17 +119,17 @@ add_task(async function testSidebarSetOb
     obj.prop1 = 123;
     obj[Symbol('sym1')] = 456;
     obj.cyclic = obj;
     obj;
   `;
 
   const evalResult = await inspectedWindowFront.eval(fakeExtCallerInfo, expression, {
     evalResultAsGrip: true,
-    toolboxConsoleActorID: toolbox.target.form.consoleActor,
+    toolboxConsoleActorID: toolbox.target.activeConsole.actor,
   });
 
   sidebar.setObjectValueGrip(evalResult.valueGrip, "Expected Root Title");
 
   // Wait the ObjectInspector component to be rendered and test its content.
   await testSetExpressionSidebarPanel(sidebarPanelContent, {
     nodesLength: 4,
     propertiesNames: ["cyclic", "prop1", "Symbol(sym1)"],
--- a/devtools/client/inspector/shared/reflow-tracker.js
+++ b/devtools/client/inspector/shared/reflow-tracker.js
@@ -32,17 +32,17 @@ ReflowTracker.prototype = {
       this.reflowFront = null;
     }
 
     this.listeners.clear();
   },
 
   async startTracking() {
     // Initialize reflow front if necessary.
-    if (!this.reflowFront && this.target.form.reflowActor) {
+    if (!this.reflowFront) {
       this.reflowFront = await this.target.getFront("reflow");
     }
 
     if (this.reflowFront) {
       this.reflowFront.on("reflows", this.onReflow);
       this.reflowFront.start();
     }
   },
--- a/devtools/client/netmonitor/src/har/har-automation.js
+++ b/devtools/client/netmonitor/src/har/har-automation.js
@@ -40,40 +40,36 @@ function HarAutomation(toolbox) {
 
 HarAutomation.prototype = {
   // Initialization
 
   initialize: function(toolbox) {
     this.toolbox = toolbox;
 
     const target = toolbox.target;
-    this.startMonitoring(target.client, target.form);
+    this.startMonitoring(target.client);
   },
 
   destroy: function() {
     if (this.collector) {
       this.collector.stop();
     }
 
     if (this.tabWatcher) {
       this.tabWatcher.disconnect();
     }
   },
 
   // Automation
 
-  startMonitoring: function(client, tabGrip, callback) {
+  startMonitoring: function(client, callback) {
     if (!client) {
       return;
     }
 
-    if (!tabGrip) {
-      return;
-    }
-
     this.debuggerClient = client;
     this.targetFront = this.toolbox.target.activeTab;
     this.webConsoleClient = this.toolbox.target.activeConsole;
 
     this.tabWatcher = new TabWatcher(this.toolbox, this);
     this.tabWatcher.connect();
   },
 
--- a/devtools/client/webconsole/webconsole-connection-proxy.js
+++ b/devtools/client/webconsole/webconsole-connection-proxy.js
@@ -84,24 +84,16 @@ WebConsoleConnectionProxy.prototype = {
    * @type object
    */
   _connectTimer: null,
 
   _connectDefer: null,
   _disconnecter: null,
 
   /**
-   * The WebConsoleActor ID.
-   *
-   * @private
-   * @type string
-   */
-  _consoleActor: null,
-
-  /**
    * Initialize a debugger client and connect it to the debugger server.
    *
    * @return object
    *         A promise object that is resolved/rejected based on the success of
    *         the connection initialization.
    */
   connect: function() {
     if (this._connectDefer) {
@@ -128,20 +120,18 @@ WebConsoleConnectionProxy.prototype = {
     client.addListener("pageError", this._onPageError);
     client.addListener("consoleAPICall", this._onConsoleAPICall);
     client.addListener("lastPrivateContextExited",
                        this._onLastPrivateContextExited);
 
     this.target.on("will-navigate", this._onTabWillNavigate);
     this.target.on("navigate", this._onTabNavigated);
 
-    this._consoleActor = this.target.form.consoleActor;
     if (this.target.isBrowsingContext) {
-      const tab = this.target.form;
-      this.webConsoleFrame.onLocationChange(tab.url, tab.title);
+      this.webConsoleFrame.onLocationChange(this.target.url, this.target.title);
     }
     this._attachConsole();
 
     return connPromise;
   },
 
   /**
    * Connection timeout handler.
@@ -270,49 +260,49 @@ WebConsoleConnectionProxy.prototype = {
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
   _onPageError: function(type, packet) {
-    if (!this.webConsoleFrame || packet.from != this._consoleActor) {
+    if (!this.webConsoleFrame || packet.from != this.webConsoleClient.actor) {
       return;
     }
     this.dispatchMessageAdd(packet);
   },
   /**
    * The "logMessage" message type handler. We redirect any message to the UI
    * for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
   _onLogMessage: function(type, packet) {
-    if (!this.webConsoleFrame || packet.from != this._consoleActor) {
+    if (!this.webConsoleFrame || packet.from != this.webConsoleClient.actor) {
       return;
     }
     this.dispatchMessageAdd(packet);
   },
   /**
    * The "consoleAPICall" message type handler. We redirect any message to
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
   _onConsoleAPICall: function(type, packet) {
-    if (!this.webConsoleFrame || packet.from != this._consoleActor) {
+    if (!this.webConsoleFrame || packet.from != this.webConsoleClient.actor) {
       return;
     }
     this.dispatchMessageAdd(packet);
   },
   /**
    * The "networkEvent" message type handler. We redirect any message to
    * the UI for displaying.
    *
@@ -346,17 +336,17 @@ WebConsoleConnectionProxy.prototype = {
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
   _onLastPrivateContextExited: function(type, packet) {
-    if (this.webConsoleFrame && packet.from == this._consoleActor) {
+    if (this.webConsoleFrame && packet.from == this.webConsoleClient.actor) {
       this.webConsoleFrame.clearPrivateMessages();
     }
   },
 
   /**
    * The "navigate" event handlers. We redirect any message to the UI for displaying.
    *
    * @private
--- a/devtools/server/tests/mochitest/test_webextension-addon-debugging-connect.html
+++ b/devtools/server/tests/mochitest/test_webextension-addon-debugging-connect.html
@@ -41,30 +41,29 @@ async function test_connect_addon(oopMod
   ok(addonTargetFront, "The expected webextension addon actor has been found");
 
   // Connect to the target addon actor and wait for the updated list of frames.
   const addonTarget = await TargetFactory.forRemoteTab({
     activeTab: addonTargetFront,
     client,
     chrome: true,
   });
-  is(addonTarget.form.isOOP, oopMode,
+  is(addonTarget.targetForm.isOOP, oopMode,
      "Got the expected oop mode in the webextension actor form");
   const frames = await waitForFramesUpdated(addonTarget);
   const backgroundPageFrame = frames.filter((frame) => {
     return frame.url && frame.url.endsWith("/_generated_background_page.html");
   }).pop();
   is(backgroundPageFrame.addonID, extension.id, "Got an extension frame");
   ok(addonTarget.activeTab, "The addon target has an activeTab");
 
   // When running in oop mode we can explicitly attach the thread without locking
   // the main process.
   if (oopMode) {
-    const [, threadFront] = await addonTarget.activeTab
-                                             .attachThread(addonTarget.form.threadActor);
+    const [, threadFront] = await addonTarget.activeTab.attachThread();
 
     ok(threadFront, "Got a threadFront for the target addon");
     is(threadFront.paused, true, "The addon threadActor is paused");
     await threadFront.resume();
     is(threadFront.paused, false, "The addon threadActor has been resumed");
 
     await threadFront.detach();
   }