diff --git a/devtools/client/framework/target-from-url.js b/devtools/client/framework/target-from-url.js index 34dc3bfb8dab..018079a472d7 100644 --- a/devtools/client/framework/target-from-url.js +++ b/devtools/client/framework/target-from-url.js @@ -133,23 +133,6 @@ async function _targetFromURL(client, id, type, chrome) { } throw ex; } - } else if (type == "window") { - // Fetch target for a remote window actor - DevToolsServer.allowChromeProcess = true; - try { - id = parseInt(id, 10); - if (isNaN(id)) { - throw new Error("targetFromURL, window requires id parameter"); - } - front = await client.mainRoot.getWindow({ - outerWindowID: id, - }); - } 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`); } diff --git a/devtools/client/framework/test/browser_target_from_url.js b/devtools/client/framework/test/browser_target_from_url.js index d9fa11e3d097..a95162c01ba1 100644 --- a/devtools/client/framework/test/browser_target_from_url.js +++ b/devtools/client/framework/test/browser_target_from_url.js @@ -37,18 +37,8 @@ add_task(async function() { is(e.message, "targetFromURL, unsupported type 'x' parameter"); } - info("Test browser window"); - let windowId = window.docShell.outerWindowID; - target = await targetFromURL( - new URL("http://foo?type=window&id=" + windowId) - ); - is(target.url, window.location.href); - is(target.isLocalTab, false); - is(target.chrome, true); - is(target.isBrowsingContext, true); - await target.client.close(); - info("Test tab"); + let windowId = window.docShell.outerWindowID; windowId = browser.outerWindowID; target = await targetFromURL(new URL("http://foo?type=tab&id=" + windowId)); assertTarget(target, TEST_URI); diff --git a/devtools/client/fronts/targets/target-mixin.js b/devtools/client/fronts/targets/target-mixin.js index 14e70d436acf..fe4b2f2906a9 100644 --- a/devtools/client/fronts/targets/target-mixin.js +++ b/devtools/client/fronts/targets/target-mixin.js @@ -299,7 +299,6 @@ function TargetMixin(parentClass) { this.isAddon || this.isContentProcess || this.isParentProcess || - this.isWindowTarget || this._forceChrome ); } @@ -380,14 +379,6 @@ function TargetMixin(parentClass) { ); } - get isWindowTarget() { - return !!( - this.targetForm && - this.targetForm.actor && - this.targetForm.actor.match(/conn\d+\.chromeWindowTarget\d+/) - ); - } - get isMultiProcess() { return !this.window; } diff --git a/devtools/docs/backend/actor-hierarchy.md b/devtools/docs/backend/actor-hierarchy.md index 123f86a8fe2c..1968d73c7940 100644 --- a/devtools/docs/backend/actor-hierarchy.md +++ b/devtools/docs/backend/actor-hierarchy.md @@ -76,12 +76,6 @@ RootActor (root.js) | Returned by "listWorkers" request to a ContentProcessTargetActor to get | workers for the chrome of the child process. | - |-- ChromeWindowTargetActor (chrome-window.js) - | Targets a single window, such as a browser window in Firefox, but it can - | be used to reach any window in the parent process. - | Extends the abstract class BrowsingContextTargetActor. - | Returned by "getWindow" request to the root actor. - | |-- ParentProcessTargetActor (parent-process.js) | Targets all resources in the parent process of Firefox (chrome documents, | JSMs, JS XPCOM, etc.). diff --git a/devtools/server/actors/root.js b/devtools/server/actors/root.js index f02a33d9bab6..78b2fc2e94be 100644 --- a/devtools/server/actors/root.js +++ b/devtools/server/actors/root.js @@ -19,12 +19,6 @@ const { DevToolsServer } = require("devtools/server/devtools-server"); const protocol = require("devtools/shared/protocol"); const { rootSpec } = require("devtools/shared/specs/root"); -loader.lazyRequireGetter( - this, - "ChromeWindowTargetActor", - "devtools/server/actors/targets/chrome-window", - true -); loader.lazyRequireGetter( this, "ProcessDescriptorActor", @@ -197,9 +191,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, { if (this._globalActorPool) { this._globalActorPool.destroy(); } - if (this._chromeWindowActorPool) { - this._chromeWindowActorPool.destroy(); - } if (this._addonTargetActorPool) { this._addonTargetActorPool.destroy(); } @@ -217,7 +208,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, { this.conn = null; this._tabDescriptorActorPool = null; this._globalActorPool = null; - this._chromeWindowActorPool = null; this._parameters = null; }, @@ -314,34 +304,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, { return descriptorActor; }, - getWindow: function({ outerWindowID }) { - if (!DevToolsServer.allowChromeProcess) { - throw { - error: "forbidden", - message: "You are not allowed to debug windows.", - }; - } - const window = Services.wm.getOuterWindowWithId(outerWindowID); - if (!window) { - throw { - error: "notFound", - message: `No window found with outerWindowID ${outerWindowID}`, - }; - } - - if (!this._chromeWindowActorPool) { - this._chromeWindowActorPool = new Pool(this.conn, "chrome-window"); - } - - const actor = new ChromeWindowTargetActor(this.conn, window, { - isTopLevelTarget: true, - }); - actor.parentID = this.actorID; - this._chromeWindowActorPool.manage(actor); - - return actor; - }, - onTabListChanged: function() { this.conn.send({ from: this.actorID, type: "tabListChanged" }); /* It's a one-shot notification; no need to watch any more. */ diff --git a/devtools/server/actors/targets/browsing-context.js b/devtools/server/actors/targets/browsing-context.js index dfdc40d1b8dc..838b58b16ce8 100644 --- a/devtools/server/actors/targets/browsing-context.js +++ b/devtools/server/actors/targets/browsing-context.js @@ -14,8 +14,7 @@ * BrowsingContextTargetActor is an abstract class used by target actors that hold * documents, such as frames, chrome windows, etc. * - * This class is extended by FrameTargetActor, ParentProcessTargetActor, and - * ChromeWindowTargetActor. + * This class is extended by FrameTargetActor, ParentProcessTargetActor. * * See devtools/docs/backend/actor-hierarchy.md for more details. * diff --git a/devtools/server/actors/targets/chrome-window.js b/devtools/server/actors/targets/chrome-window.js deleted file mode 100644 index 234bbd2929d5..000000000000 --- a/devtools/server/actors/targets/chrome-window.js +++ /dev/null @@ -1,118 +0,0 @@ -/* 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"; - -/* - * Target actor for a single chrome window, like a browser window. - * - * This actor extends BrowsingContextTargetActor. - * - * See devtools/docs/backend/actor-hierarchy.md for more details. - */ - -const { Ci } = require("chrome"); -const Services = require("Services"); -const { - BrowsingContextTargetActor, - browsingContextTargetPrototype, -} = require("devtools/server/actors/targets/browsing-context"); - -const { extend } = require("devtools/shared/extend"); -const { - chromeWindowTargetSpec, -} = require("devtools/shared/specs/targets/chrome-window"); -const Targets = require("devtools/server/actors/targets/index"); -const TargetActorMixin = require("devtools/server/actors/targets/target-actor-mixin"); - -/** - * Protocol.js expects only the prototype object, and does not maintain the - * prototype chain when it constructs the ActorClass. For this reason we are using - * `extend` to maintain the properties of BrowsingContextTargetActor.prototype - */ -const chromeWindowTargetPrototype = extend({}, browsingContextTargetPrototype); - -/** - * Creates a ChromeWindowTargetActor for debugging a single window, like a browser window - * in Firefox, but it can be used to reach any window in the process. - * - * Currently this is parent process only because the root actor's `onGetWindow` doesn't - * try to cross process boundaries. This actor technically would work for both chrome and - * content windows, but it can't reach (most) content windows since it's parent process - * only. Since these restrictions mean that chrome windows are the main use case for - * this at the moment, it's named to match. - * - * Most of the implementation is inherited from BrowsingContextTargetActor. - * ChromeWindowTargetActor exposes all target-scoped actors via its form() request, like - * BrowsingContextTargetActor. - * - * You can request a specific window's actor via RootActor.getWindow(). - * - * @param connection DevToolsServerConnection - * The connection to the client. - * @param window DOMWindow - * The window. - * @param {Object} options - * - isTopLevelTarget: {Boolean} flag to indicate if this is the top - * level target of the DevTools session - */ -chromeWindowTargetPrototype.initialize = function( - connection, - window, - { isTopLevelTarget } -) { - BrowsingContextTargetActor.prototype.initialize.call(this, connection, { - docShell: window.docShell, - isTopLevelTarget, - }); -}; - -// Bug 1266561: This setting is mysteriously named, we should split up the -// functionality that is triggered by it. -chromeWindowTargetPrototype.isRootActor = true; - -chromeWindowTargetPrototype.observe = function(subject, topic, data) { - BrowsingContextTargetActor.prototype.observe.call(this, subject, topic, data); - if (!this.attached) { - return; - } - if (topic == "chrome-webnavigation-destroy") { - this._onDocShellDestroy(subject); - } -}; - -chromeWindowTargetPrototype._attach = function() { - if (this.attached) { - return false; - } - - BrowsingContextTargetActor.prototype._attach.call(this); - - // Listen for chrome docshells in addition to content docshells - if (this.docShell.itemType == Ci.nsIDocShellTreeItem.typeChrome) { - Services.obs.addObserver(this, "chrome-webnavigation-destroy"); - } - - return true; -}; - -chromeWindowTargetPrototype._detach = function() { - if (!this.attached) { - return false; - } - - if (this.docShell.itemType == Ci.nsIDocShellTreeItem.typeChrome) { - Services.obs.removeObserver(this, "chrome-webnavigation-destroy"); - } - - BrowsingContextTargetActor.prototype._detach.call(this); - - return true; -}; - -exports.ChromeWindowTargetActor = TargetActorMixin( - Targets.TYPES.FRAME, - chromeWindowTargetSpec, - chromeWindowTargetPrototype -); diff --git a/devtools/server/actors/targets/moz.build b/devtools/server/actors/targets/moz.build index acc56390c5cd..0c061bd12211 100644 --- a/devtools/server/actors/targets/moz.build +++ b/devtools/server/actors/targets/moz.build @@ -6,7 +6,6 @@ DevToolsModules( "browsing-context.js", - "chrome-window.js", "content-process.js", "frame.js", "index.js", diff --git a/devtools/shared/specs/index.js b/devtools/shared/specs/index.js index 2c099c1c9801..86603b2fc077 100644 --- a/devtools/shared/specs/index.js +++ b/devtools/shared/specs/index.js @@ -293,11 +293,6 @@ const Types = (exports.__TypesForTests = [ spec: "devtools/shared/specs/targets/browsing-context", front: "devtools/client/fronts/targets/browsing-context", }, - { - types: ["chromeWindowTarget"], - spec: "devtools/shared/specs/targets/chrome-window", - front: null, - }, { types: ["contentProcessTarget"], spec: "devtools/shared/specs/targets/content-process", diff --git a/devtools/shared/specs/root.js b/devtools/shared/specs/root.js index 0ec6beea22c7..500c69027532 100644 --- a/devtools/shared/specs/root.js +++ b/devtools/shared/specs/root.js @@ -44,15 +44,6 @@ const rootSpecPrototype = { }, }, - getWindow: { - request: { - outerWindowID: Option(0, "number"), - }, - response: { - window: RetVal("browsingContextTarget"), - }, - }, - listAddons: { request: { iconDataURL: Option(0, "boolean"), diff --git a/devtools/shared/specs/targets/chrome-window.js b/devtools/shared/specs/targets/chrome-window.js deleted file mode 100644 index 31aae450c891..000000000000 --- a/devtools/shared/specs/targets/chrome-window.js +++ /dev/null @@ -1,18 +0,0 @@ -/* 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 { generateActorSpec } = require("devtools/shared/protocol"); -const { extend } = require("devtools/shared/extend"); -const { - browsingContextTargetSpecPrototype, -} = require("devtools/shared/specs/targets/browsing-context"); - -const chromeWindowTargetSpec = generateActorSpec( - extend(browsingContextTargetSpecPrototype, { - typeName: "chromeWindowTarget", - }) -); - -exports.chromeWindowTargetSpec = chromeWindowTargetSpec; diff --git a/devtools/shared/specs/targets/moz.build b/devtools/shared/specs/targets/moz.build index 0fb59649bde4..d5a449358081 100644 --- a/devtools/shared/specs/targets/moz.build +++ b/devtools/shared/specs/targets/moz.build @@ -6,7 +6,6 @@ DevToolsModules( "browsing-context.js", - "chrome-window.js", "content-process.js", "frame.js", "parent-process.js",