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:
Julian Descottes 2020-04-14 13:16:33 +00:00
parent 9b57f6f875
commit ec26d8eb37
3 changed files with 5 additions and 33 deletions

View File

@ -194,18 +194,6 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
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
* tab given as first parameter.

View File

@ -249,8 +249,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
/**
* 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
* and didn't actually care about tabs.
* browser.
*/
getRoot: function() {
// Create global actors
@ -271,12 +270,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
/**
* Handles the listTabs request. The actors will survive until at least
* 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() {
const tabList = this._parameters.tabList;
@ -302,9 +295,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
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
// new map; others will go away.
if (this._tabDescriptorActorPool) {
@ -312,12 +302,7 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
}
this._tabDescriptorActorPool = newActorPool;
// We'll extend the reply here to also mention all the tabs.
Object.assign(reply, {
tabs: [...this._tabDescriptorActorPool.poolChildren()],
});
return reply;
return tabDescriptorActors;
},
getTab: async function({ outerWindowID, tabId }) {

View File

@ -20,9 +20,6 @@ types.addDictType("root.listServiceWorkerRegistrations", {
types.addDictType("root.listRemoteFrames", {
frames: "array:frameDescriptor",
});
types.addDictType("root.listTabs", {
tabs: "array:tabDescriptor",
});
types.addPolymorphicType("root.browsingContextDescriptor", [
"frameDescriptor",
"processDescriptor",
@ -43,7 +40,9 @@ const rootSpecPrototype = {
// The argument can be dropped when FF76 hits the release channel.
favicons: Option(0, "boolean"),
},
response: RetVal("root.listTabs"),
response: {
tabs: RetVal("array:tabDescriptor"),
},
},
getTab: {