Support `tabs.query` extension API
Categories
(GeckoView :: Extensions, enhancement, P3)
Tracking
(firefox67 wontfix, firefox67.0.1 wontfix, firefox68 wontfix, firefox69 wontfix)
People
(Reporter: agi, Unassigned)
References
(Blocks 1 open bug)
Details
Right now it returns an empty array, it should return a list of tabs as described in: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/query
Comment 1•6 years ago
|
||
This bug might be related to tabId bug 1551377.
Reporter | ||
Comment 2•6 years ago
|
||
From my quick testing tabs.query
seems to return only the last tab that received a navigation event but not all of them.
We inherit the query
method from a common implementation here: https://searchfox.org/mozilla-central/rev/967bc2a7540a505ad31d186804bd048bb2fa3689/toolkit/components/extensions/parent/ext-tabs-base.js#1923-1953
In GeckoView (IIRC) every tab is in it's own window, so the problem is likely in the mobile implementation on WindowTracker
: https://searchfox.org/mozilla-central/rev/967bc2a7540a505ad31d186804bd048bb2fa3689/mobile/android/components/extensions/ext-utils.js#745-761
It could also related to the fact the all tabs have the same ID, as mentioned by Chris in Comment #1. In that case the place to look at would be our TabTracker
implementation: https://searchfox.org/mozilla-central/rev/967bc2a7540a505ad31d186804bd048bb2fa3689/mobile/android/components/extensions/ext-utils.js#235
This is the code I've been testing this with (in a background script):
function logTabs(tabs) {
console.log(tabs.map(tab => tab.url));
}
function onError(error) {
console.log(`Error: ${error}`);
}
function queryTabs() {
const querying = browser.tabs.query({currentWindow: true});
querying.then(logTabs, onError);
setTimeout(queryTabs, 1000);
}
queryTabs();
Comment 3•6 years ago
|
||
I think my changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1539144 make tabs.query
to work correctly. Assumption is that every GeckoSession represents a Gecko window with exactly one tab.
Comment 4•6 years ago
|
||
(In reply to Krzysztof Jan Modras from comment #3)
I think my changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1539144 make
tabs.query
to work correctly. Assumption is that every GeckoSession represents a Gecko window with exactly one tab.
That approach holds only in case all sessions are loaded in GeckoView - I can imagine an application that holds unused session out side of GeckoView util they get accessed by the user, in such case tabs.query
will fail to return information about them.
A more GeckoView-like approach would be to delegate tabs.query
to GeckoRuntime so application can decide which tabs are available.
In addon perspective the first approach should be good enough for now as addons should probably only interact with tabs that are currently in use, but behavior may be problematic to expecting it developers.
Reporter | ||
Comment 5•6 years ago
•
|
||
(In reply to Krzysztof Jan Modras from comment #3)
I think my changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1539144 make
tabs.query
to work correctly. Assumption is that every GeckoSession represents a Gecko window with exactly one tab.
Yep, that should be correct.
(In reply to Krzysztof Jan Modras from comment #4)
That approach holds only in case all sessions are loaded in GeckoView - I can imagine an application that holds unused session out side of GeckoView util they get accessed by the user, in such case
tabs.query
will fail to return information about them.
A more GeckoView-like approach would be to delegatetabs.query
to GeckoRuntime so application can decide which tabs are available.In addon perspective the first approach should be good enough for now as addons should probably only interact with tabs that are currently in use, but behavior may be problematic to expecting it developers.
I think it's OK to ignore GeckoSession
s that are not attached to a GeckoView
, especially for MVP. If there's a clear need / usecase for it we can discuss it in a separate bug.
Updated•6 years ago
|
Comment 6•6 years ago
|
||
I'm editing a bunch of GeckoView bugs. If you'd like to filter all this bugmail, search and destroy emails containing this UUID:
e88a5094-0fc0-4b7c-b7c5-aef00a11dbc9
Reporter | ||
Comment 7•5 years ago
|
||
Mass moving bugs to the Extension component.
Comment 8•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:amoya, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 9•2 years ago
|
||
In fact, tabs.query()
seems to be supported nowadays.
Comment 10•2 years ago
|
||
I am going to close this bug. Unfortunately I cannot retrieve the bug for the implementation.
:robwu if you remember, please add the bug ID here, otherwise ignore my NI. Thanks!
Updated•2 years ago
|
Comment 11•2 years ago
|
||
It was fixed by the "depends on" bug, specifically https://hg.mozilla.org/mozilla-central/rev/d74231becedc . There are some other features missing from the tabs API, but these are already covered by other bugs. Notably bug 1583281.
Description
•