Expose all tabs to the tabs API and support tabs.discard
Categories
(GeckoView :: Extensions, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: agi, Unassigned, Mentored)
References
(Blocks 4 open bugs, )
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
GeckoView does not store a list of all GeckoSessions by design.
Embedders might keep some GeckoSessions internally and only feed them to GeckoView whenever they need to display the page to the user.
Extension can "unload" tabs using the https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/discard API, and can get a list of all tabs (including the discarded ones).
We need to add a delegate in GeckoView to let embedders provide the full list of GeckoSessions when needed by extensions and one to "unload" a tab using the tabs.discard
API.
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 2•5 years ago
|
||
Mass moving bugs to the Extension component.
Reporter | ||
Comment 5•4 years ago
|
||
A way to implement this could be the following:
- Add
TabDetails
to WebExtension: https://searchfox.org/mozilla-central/rev/c59d9181cbcd8356ce9271723e31be11641e7010/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java#29,TabDetails
can just be a data class that contains either aGeckoSession
(if the tab is loaded) or all details for a "discarded" tab, roughly mimicking thetabs.Tag
object: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/Tabs/Tab, something like this:
public class TabDetails {
// Either this
public GeckoSession session;
// or all of these
public String sessionContextId;
public String favIconUrl;
public int id;
public boolean isPrivateBrowsing;
public String title;
public String url;
}
- Add
GeckoResult<List<TabDetails>> onTabList()
here: https://searchfox.org/mozilla-central/rev/c59d9181cbcd8356ce9271723e31be11641e7010/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java#762
this method will be called whenever the extension callstabs.query
or any other method that needs the list of tabs. - Rewrite
windowTracker.getAll
to callonTabList()
instead and use that if the embedder returns a non-null
value: https://searchfox.org/mozilla-central/rev/c59d9181cbcd8356ce9271723e31be11641e7010/mobile/android/components/extensions/ext-android.js#577-585 (the reason why window even though these are tabs is... interesting... I can get into that if needed), if we have a list the getAll method would return one window with a list of tabs in it (probably will have to have a customWindow
class that extends from this https://searchfox.org/mozilla-central/source/mobile/android/components/extensions/ext-android.js#518), an example on how to query the embedder can be found here: https://hg.mozilla.org/mozilla-central/rev/fa01d9615f6d3fd93488178f2e5945ab600521c1 (in this patch the extension is callingopenOptionsPage
which causes GeckoView to callonOpenOptionsPage
)
Comment 6•4 years ago
|
||
Updated•4 years ago
|
Comment 8•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 12•2 years ago
|
||
When this is being worked on, please verify the scenarios described in Bug 1465828.
Comment 13•1 year ago
|
||
Note that with the coming opening up of the add on store this is going to prevent some add ons coming to Fenix
Description
•