From 6a1c4bd7b2b3a7e54e0937270d639e1f978ab646 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 26 Sep 2019 09:16:17 +0000 Subject: [PATCH] Bug 1581536 - Remove unused addon target front and spec r=ochameau Differential Revision: https://phabricator.services.mozilla.com/D47050 --HG-- extra : moz-landing-system : lando --- devtools/shared/fronts/targets/addon.js | 113 ----------------------- devtools/shared/fronts/targets/moz.build | 1 - devtools/shared/specs/index.js | 5 - devtools/shared/specs/targets/addon.js | 46 --------- devtools/shared/specs/targets/moz.build | 1 - 5 files changed, 166 deletions(-) delete mode 100644 devtools/shared/fronts/targets/addon.js delete mode 100644 devtools/shared/specs/targets/addon.js diff --git a/devtools/shared/fronts/targets/addon.js b/devtools/shared/fronts/targets/addon.js deleted file mode 100644 index 24eadb0fd1d0..000000000000 --- a/devtools/shared/fronts/targets/addon.js +++ /dev/null @@ -1,113 +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 { addonTargetSpec } = require("devtools/shared/specs/targets/addon"); -const { - FrontClassWithSpec, - registerFront, -} = require("devtools/shared/protocol"); -loader.lazyRequireGetter( - this, - "BrowsingContextTargetFront", - "devtools/shared/fronts/targets/browsing-context", - true -); - -class AddonTargetFront extends FrontClassWithSpec(addonTargetSpec) { - constructor(client, targetFront, parentFront) { - super(client, targetFront, parentFront); - - this.client = client; - - this.traits = {}; - } - - form(json) { - this.actorID = json.actor; - - // Save the full form for Target class usage. - // Do not use `form` name to avoid colliding with protocol.js's `form` method - this.targetForm = json; - - // We used to manipulate the form rather than the front itself. - // Expose all form attributes to ease accessing them. - for (const name in json) { - if (name == "actor") { - continue; - } - this[name] = json[name]; - } - } - - isLegacyTemporaryExtension() { - if (!this.type) { - // If about:debugging is connected to an older then 59 remote Firefox, and type is - // not available on the addon/webextension actors, return false to avoid showing - // irrelevant warning messages. - return false; - } - return ( - this.type == "extension" && - this.temporarilyInstalled && - !this.isWebExtension && - !this.isAPIExtension - ); - } - - /** - * Returns the actual target front for web extensions. - * - * AddonTargetActor is used for WebExtensions, but this isn't the final target actor - * we want to use for it. AddonTargetActor only expose metadata about the Add-on, like - * its name, type, ... Instead, we want to use a WebExtensionTargetActor, which - * inherits from BrowsingContextTargetActor. This connect method is used to retrive - * the final target actor to use. - */ - async connect() { - if ( - this.isWebExtension && - this.client.mainRoot.traits.webExtensionAddonConnect - ) { - // The AddonTargetFront 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 targetForm from a WebExtensionTargetActor instance). - const { form } = await super.connect(); - const front = new BrowsingContextTargetFront(this.client, { - actor: form.actor, - }); - front.form(form); - this.manage(front); - return front; - } - return this; - } - - async attach() { - if (this._attach) { - return this._attach; - } - this._attach = (async () => { - const response = await super.attach(); - - this._threadActor = response.threadActor; - - return this.attachConsole(); - })(); - return this._attach; - } - - reconfigure() { - // Toolbox and options panel are calling this method but Addon Target can't be - // reconfigured. So we ignore this call here. - return Promise.resolve(); - } -} - -exports.AddonTargetFront = AddonTargetFront; -registerFront(AddonTargetFront); diff --git a/devtools/shared/fronts/targets/moz.build b/devtools/shared/fronts/targets/moz.build index 80a7bb6da197..5c1c4c433f35 100644 --- a/devtools/shared/fronts/targets/moz.build +++ b/devtools/shared/fronts/targets/moz.build @@ -5,7 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. DevToolsModules( - 'addon.js', 'browsing-context.js', 'content-process.js', 'local-tab.js', diff --git a/devtools/shared/specs/index.js b/devtools/shared/specs/index.js index 89caa37fc2d7..c9810474a540 100644 --- a/devtools/shared/specs/index.js +++ b/devtools/shared/specs/index.js @@ -234,11 +234,6 @@ const Types = (exports.__TypesForTests = [ spec: "devtools/shared/specs/symbol-iterator", front: null, }, - { - types: ["addonTarget"], - spec: "devtools/shared/specs/targets/addon", - front: "devtools/shared/fronts/targets/addon", - }, { types: ["browsingContextTarget"], spec: "devtools/shared/specs/targets/browsing-context", diff --git a/devtools/shared/specs/targets/addon.js b/devtools/shared/specs/targets/addon.js deleted file mode 100644 index 90ab36053f40..000000000000 --- a/devtools/shared/specs/targets/addon.js +++ /dev/null @@ -1,46 +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 { RetVal, generateActorSpec } = require("devtools/shared/protocol"); - -const addonTargetSpec = generateActorSpec({ - typeName: "addonTarget", - - methods: { - attach: { - request: {}, - response: RetVal("json"), - }, - detach: { - request: {}, - response: RetVal("json"), - }, - connect: { - request: {}, - response: RetVal("json"), - }, - reload: { - request: {}, - response: {}, - }, - push: { - request: {}, - response: RetVal("json"), - }, - }, - - events: { - // The thread actor is no longer emitting newSource event in the name of the target - // actor (bug 1269919), but as we may still connect to older servers which still do, - // we have to keep it being mentioned here. Otherwise the event is considered as a - // response to a request and confuses the packet ordering. - // We can remove that once FF66 is no longer supported. - newSource: { - type: "newSource", - }, - }, -}); - -exports.addonTargetSpec = addonTargetSpec; diff --git a/devtools/shared/specs/targets/moz.build b/devtools/shared/specs/targets/moz.build index c9a245ef8372..32c2725a1927 100644 --- a/devtools/shared/specs/targets/moz.build +++ b/devtools/shared/specs/targets/moz.build @@ -5,7 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. DevToolsModules( - 'addon.js', 'browsing-context.js', 'chrome-window.js', 'content-process.js',