From 58ca7cba27dcac4f1be43b9265b00c25f946c4c7 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Tue, 14 Apr 2020 12:51:55 +0000 Subject: [PATCH] Bug 1618691 - Remove < FF75 backward compatibility code for getTab and listTabs r=ochameau Depends on D69542 Differential Revision: https://phabricator.services.mozilla.com/D69543 --HG-- extra : moz-landing-system : lando --- devtools/client/fronts/root.js | 70 ++-------------------------------- devtools/server/actors/root.js | 6 +-- devtools/shared/specs/root.js | 8 +--- 3 files changed, 8 insertions(+), 76 deletions(-) diff --git a/devtools/client/fronts/root.js b/devtools/client/fronts/root.js index 0edbe8f8c9e0..3c60dd4e6651 100644 --- a/devtools/client/fronts/root.js +++ b/devtools/client/fronts/root.js @@ -11,24 +11,6 @@ const { } = require("devtools/shared/protocol"); loader.lazyRequireGetter(this, "getFront", "devtools/shared/protocol", true); -loader.lazyRequireGetter( - this, - "TabDescriptorFront", - "devtools/client/fronts/descriptors/tab", - true -); -loader.lazyRequireGetter( - this, - "BrowsingContextTargetFront", - "devtools/client/fronts/targets/browsing-context", - true -); -loader.lazyRequireGetter( - this, - "LocalTabTargetFront", - "devtools/client/fronts/targets/local-tab", - true -); class RootFront extends FrontClassWithSpec(rootSpec) { constructor(client, targetFront, parentFront) { @@ -229,8 +211,8 @@ class RootFront extends FrontClassWithSpec(rootSpec) { } try { - const form = tabs[i]; - const target = await this._createTargetFrontForTabForm(form); + const tabDescriptor = tabs[i]; + const target = await tabDescriptor.getTarget(); target.setIsSelected(i == selected); targets.push(target); } catch (e) { @@ -279,52 +261,8 @@ class RootFront extends FrontClassWithSpec(rootSpec) { } } - const form = await super.getTab(packet); - return this._createTargetFrontForTabForm(form, filter); - } - - async _createTargetFrontForTabForm(form, filter = {}) { - let front = this.actor(form.actor); - if (front) { - if (!form.actor.includes("tabDescriptor")) { - // Backwards compatibility for servers FF74 and older. - front.form(form); - return front; - } - - return front.getTarget(); - } - - if (!form.actor.includes("tabDescriptor")) { - // Backwards compatibility for servers FF74 and older. - - // Instanciate a specialized class for a local tab as it needs some more - // client side integration with the Firefox frontend. - // But ignore the fake `tab` object we receive, where there is only a - // `linkedBrowser` attribute, but this isn't a real element. - // devtools/client/framework/test/browser_toolbox_target.js is passing such - // a fake tab. - if (filter?.tab?.tagName == "tab") { - front = new LocalTabTargetFront(this._client, null, this, filter.tab); - } else { - front = new BrowsingContextTargetFront(this._client, null, this); - } - // As these fronts aren't instantiated by protocol.js, we have to set their actor ID - // manually like that: - front.actorID = form.actor; - front.form(form); - this.manage(front); - return front; - } - - const descriptorFront = new TabDescriptorFront(this._client, null, this); - // As these fronts aren't instantiated by protocol.js, we have to set their actor ID - // manually like that: - descriptorFront.actorID = form.actor; - descriptorFront.form(form); - this.manage(descriptorFront); - front = await descriptorFront.getTarget(filter); - return front; + const descriptorFront = await super.getTab(packet); + return descriptorFront.getTarget(filter); } /** diff --git a/devtools/server/actors/root.js b/devtools/server/actors/root.js index 8ab3d3e6a979..257b85932045 100644 --- a/devtools/server/actors/root.js +++ b/devtools/server/actors/root.js @@ -322,9 +322,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, { // We'll extend the reply here to also mention all the tabs. Object.assign(reply, { selected: selected || 0, - tabs: [...this._tabDescriptorActorPool.poolChildren()].map(descriptor => - descriptor.form() - ), + tabs: [...this._tabDescriptorActorPool.poolChildren()], }); return reply; @@ -362,7 +360,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, { descriptorActor.parentID = this.actorID; this._tabDescriptorActorPool.manage(descriptorActor); - return descriptorActor.form(); + return descriptorActor; }, getWindow: function({ outerWindowID }) { diff --git a/devtools/shared/specs/root.js b/devtools/shared/specs/root.js index 70c500b8e93f..2eee189410f1 100644 --- a/devtools/shared/specs/root.js +++ b/devtools/shared/specs/root.js @@ -21,9 +21,7 @@ types.addDictType("root.listRemoteFrames", { frames: "array:frameDescriptor", }); types.addDictType("root.listTabs", { - // Backwards compatibility for servers FF74 and before - // once FF75 is merged into release, we can return tabDescriptors directly. - tabs: "array:json", + tabs: "array:tabDescriptor", selected: "number", }); types.addPolymorphicType("root.browsingContextDescriptor", [ @@ -55,9 +53,7 @@ const rootSpecPrototype = { tabId: Option(0, "number"), }, response: { - // Backwards compatibility for servers FF74 and before - // once FF75 is merged into release, we can return the tabDescriptor directly. - tab: RetVal("json"), + tab: RetVal("tabDescriptor"), }, },