fenix
fenix copied to clipboard
[Bug]: When running browser.tabs.query({}) the index of all tabs is 0
Steps to reproduce
I noticed this bug when porting my Firefox addon to Android. When I get tabs using browser.tabs.query({}).then(e=> { console.log(e)})
, I look for the index property in each of the tabs
- Load any temporary extension in about:debugging (just to open the about:devtools-toolbox console)
- Click inspect to open the about:devtools-toolbox then click Console
- Paste the following line:
browser.tabs.query({}).then(e=> { console.log(e)})
- Look at the console output. For each of the tab objects, the index integer should be different
I think the index property should list the tabs in the order as they're viewed by the user on Android too.
Expected behaviour
On Firefox Nightly on Windows, the index integer is different for every tab. Here is an example output:
Array(24) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
0: Object { id: 1, index: 0, windowId: 1, … }
1: Object { id: 8, index: 1, windowId: 1, … }
2: Object { id: 32, index: 2, windowId: 1, … }
Actual behaviour
- Load an addon in Firefox Nightly on Android (using web-ext)
- Go to about:debugging#/setup in Firefox Nightly on your computer and enable USB debugging
- To select your device, click connect
- Click inspect to open the about:devtools-toolbox then click Console
- Paste the following line:
browser.tabs.query({}).then(e=> { console.log(e)})
- Look at the console output. For each of the tab objects, the index integer is the same:
Array [ {…}, {…} ]
0: Object { id: 10051, index: 0, windowId: 51, … }
1: Object { id: 10058, index: 0, windowId: 58, … }
Device name
No response
Android version
Android 12
Firefox release type
Firefox Nightly
Firefox version
105
Device logs
No response
Additional information
No response
┆Issue is synchronized with this Jira Task
@artisticfox8 The indexes are 0 because each tab is in its own window. If you look at the other properties, compared with desktop, each tab has a different parent window id. You would get the same result on desktop if you opened one tab in different windows and then run tabs.query()
@artisticfox8 The indexes are 0 because each tab is in its own window. If you look at the other properties, compared with desktop, each tab has a different parent window id. You would get the same result on desktop if you opened one tab in different windows and then run
tabs.query()
While this is true, the tabs all behave like they are in one window, since this is Android. In my opinion the index property should show the order of tabs as they appear in the tab switcher. This is the way it is on desktop, the tabs indexes and their position in the tab bar match
Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1812854
Change performed by the Move to Bugzilla add-on.