Bug 1514819 - Convert RootFront.getWindow to return a front instead of a form. r=yulia
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 18 Dec 2018 08:54:01 +0000
changeset 451278 e633fd3fbd905d1cbbcd35ed5b888bcfe4e89e7f
parent 451277 b068ba3cc5c3019d059e03321f6ee48d83a2cac8
child 451279 af4a0603c641b9235f94af26106557b5538b38a4
push id35232
push userebalazs@mozilla.com
push dateWed, 19 Dec 2018 15:45:00 +0000
treeherdermozilla-central@335cc6f2cbb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1514819
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 1514819 - Convert RootFront.getWindow to return a front instead of a form. r=yulia This method is only used by target-from-url, it allows to return a target got one precise top level window and instead of the whole main process. It looks like it was the very last non-front/still-form target codepath. Differential Revision: https://phabricator.services.mozilla.com/D14841
devtools/client/framework/target-from-url.js
devtools/shared/specs/root.js
--- a/devtools/client/framework/target-from-url.js
+++ b/devtools/client/framework/target-from-url.js
@@ -53,17 +53,17 @@ exports.targetFromURL = async function t
   if (!type) {
     throw new Error("targetFromURL, missing type parameter");
   }
   let id = params.get("id");
   // Allows to spawn a chrome enabled target for any context
   // (handy to debug chrome stuff in a content process)
   let chrome = params.has("chrome");
 
-  let form, front;
+  let front;
   if (type === "tab") {
     // Fetch target for a remote tab
     id = parseInt(id, 10);
     if (isNaN(id)) {
       throw new Error(`targetFromURL, wrong tab id '${id}', should be a number`);
     }
     try {
       front = await client.mainRoot.getTab({ outerWindowID: id });
@@ -92,32 +92,31 @@ exports.targetFromURL = async function t
   } else if (type == "window") {
     // Fetch target for a remote window actor
     DebuggerServer.allowChromeProcess = true;
     try {
       id = parseInt(id, 10);
       if (isNaN(id)) {
         throw new Error("targetFromURL, window requires id parameter");
       }
-      const response = await client.mainRoot.getWindow({
+      front = await client.mainRoot.getWindow({
         outerWindowID: id,
       });
-      form = response.window;
       chrome = true;
     } catch (ex) {
       if (ex.error == "notFound") {
         throw new Error(`targetFromURL, window with id '${id}' doesn't exist`);
       }
       throw ex;
     }
   } else {
     throw new Error(`targetFromURL, unsupported type '${type}' parameter`);
   }
 
-  return TargetFactory.forRemoteTab({ client, form, activeTab: front, chrome });
+  return TargetFactory.forRemoteTab({ client, activeTab: front, chrome });
 };
 
 /**
  * Create a DebuggerClient for a given URL object having various query parameters:
  *
  * host:
  *    {String} The hostname or IP address to connect to.
  * port:
--- a/devtools/shared/specs/root.js
+++ b/devtools/shared/specs/root.js
@@ -1,18 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 { types, generateActorSpec, RetVal, Arg, Option } = require("devtools/shared/protocol");
 
-types.addDictType("root.getWindow", {
-  window: "json",
-});
 types.addDictType("root.listWorkers", {
   workers: "array:workerTarget",
 });
 types.addDictType("root.listServiceWorkerRegistrations", {
   registrations: "array:json",
 });
 types.addDictType("root.listProcesses", {
   processes: "array:json",
@@ -47,17 +44,19 @@ const rootSpecPrototype = {
         tab: RetVal("browsingContextTarget"),
       },
     },
 
     getWindow: {
       request: {
         outerWindowID: Option(0, "number"),
       },
-      response: RetVal("root.getWindow"),
+      response: {
+        window: RetVal("browsingContextTarget"),
+      },
     },
 
     listAddons: {
       request: {},
       response: {
         addons: RetVal("array:addonTarget"),
       },
     },