mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1618691 - Simplify RootActor::listTabs response r=ochameau
Depends on D65693 Differential Revision: https://phabricator.services.mozilla.com/D70174 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9b57f6f875
commit
ec26d8eb37
@ -194,18 +194,6 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
|
|||||||
return this.getProcess(0);
|
return this.getProcess(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Override default listTabs request in order to return a list of
|
|
||||||
* BrowsingContextTargetFronts while updating their selected state.
|
|
||||||
*
|
|
||||||
* Backward compatibility: favicons is only useful for FF75 or older.
|
|
||||||
* It can be removed when Firefox 76 hits the release channel.
|
|
||||||
*/
|
|
||||||
async listTabs({ favicons } = {}) {
|
|
||||||
const { tabs } = await super.listTabs({ favicons });
|
|
||||||
return tabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the target actor for the currently selected tab, or for a specific
|
* Fetch the target actor for the currently selected tab, or for a specific
|
||||||
* tab given as first parameter.
|
* tab given as first parameter.
|
||||||
|
@ -249,8 +249,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the "root" form, which lists all the global actors that affect the entire
|
* Gets the "root" form, which lists all the global actors that affect the entire
|
||||||
* browser. This can replace usages of `listTabs` that only wanted the global actors
|
* browser.
|
||||||
* and didn't actually care about tabs.
|
|
||||||
*/
|
*/
|
||||||
getRoot: function() {
|
getRoot: function() {
|
||||||
// Create global actors
|
// Create global actors
|
||||||
@ -271,12 +270,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
|
|||||||
/**
|
/**
|
||||||
* Handles the listTabs request. The actors will survive until at least
|
* Handles the listTabs request. The actors will survive until at least
|
||||||
* the next listTabs request.
|
* the next listTabs request.
|
||||||
*
|
|
||||||
* ⚠ WARNING ⚠ This can be a very expensive operation, especially if there are many
|
|
||||||
* open tabs. It will cause us to visit every tab, load a frame script, start a
|
|
||||||
* devtools server, and read some data. With lazy tab support (bug 906076), this
|
|
||||||
* would trigger any lazy tabs to be loaded, greatly increasing resource usage. Avoid
|
|
||||||
* this method whenever possible.
|
|
||||||
*/
|
*/
|
||||||
listTabs: async function() {
|
listTabs: async function() {
|
||||||
const tabList = this._parameters.tabList;
|
const tabList = this._parameters.tabList;
|
||||||
@ -302,9 +295,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
|
|||||||
newActorPool.manage(tabDescriptorActor);
|
newActorPool.manage(tabDescriptorActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start with the root reply, which includes the global actors for the whole browser.
|
|
||||||
const reply = this.getRoot();
|
|
||||||
|
|
||||||
// Drop the old actorID -> actor map. Actors that still mattered were added to the
|
// Drop the old actorID -> actor map. Actors that still mattered were added to the
|
||||||
// new map; others will go away.
|
// new map; others will go away.
|
||||||
if (this._tabDescriptorActorPool) {
|
if (this._tabDescriptorActorPool) {
|
||||||
@ -312,12 +302,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
|
|||||||
}
|
}
|
||||||
this._tabDescriptorActorPool = newActorPool;
|
this._tabDescriptorActorPool = newActorPool;
|
||||||
|
|
||||||
// We'll extend the reply here to also mention all the tabs.
|
return tabDescriptorActors;
|
||||||
Object.assign(reply, {
|
|
||||||
tabs: [...this._tabDescriptorActorPool.poolChildren()],
|
|
||||||
});
|
|
||||||
|
|
||||||
return reply;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getTab: async function({ outerWindowID, tabId }) {
|
getTab: async function({ outerWindowID, tabId }) {
|
||||||
|
@ -20,9 +20,6 @@ types.addDictType("root.listServiceWorkerRegistrations", {
|
|||||||
types.addDictType("root.listRemoteFrames", {
|
types.addDictType("root.listRemoteFrames", {
|
||||||
frames: "array:frameDescriptor",
|
frames: "array:frameDescriptor",
|
||||||
});
|
});
|
||||||
types.addDictType("root.listTabs", {
|
|
||||||
tabs: "array:tabDescriptor",
|
|
||||||
});
|
|
||||||
types.addPolymorphicType("root.browsingContextDescriptor", [
|
types.addPolymorphicType("root.browsingContextDescriptor", [
|
||||||
"frameDescriptor",
|
"frameDescriptor",
|
||||||
"processDescriptor",
|
"processDescriptor",
|
||||||
@ -43,7 +40,9 @@ const rootSpecPrototype = {
|
|||||||
// The argument can be dropped when FF76 hits the release channel.
|
// The argument can be dropped when FF76 hits the release channel.
|
||||||
favicons: Option(0, "boolean"),
|
favicons: Option(0, "boolean"),
|
||||||
},
|
},
|
||||||
response: RetVal("root.listTabs"),
|
response: {
|
||||||
|
tabs: RetVal("array:tabDescriptor"),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
getTab: {
|
getTab: {
|
||||||
|
Loading…
Reference in New Issue
Block a user