зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
8214e4fd09
Коммит
58ca7cba27
|
@ -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 <tab> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 }) {
|
||||
|
|
|
@ -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"),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче