fenix icon indicating copy to clipboard operation
fenix copied to clipboard

[Bug]: When running browser.tabs.query({}) the index of all tabs is 0

Open artisticfox8 opened this issue 2 years ago • 3 comments

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

  1. Load any temporary extension in about:debugging (just to open the about:devtools-toolbox console)
  2. Click inspect to open the about:devtools-toolbox then click Console
  3. Paste the following line: browser.tabs.query({}).then(e=> { console.log(e)})
  4. 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

  1. Load an addon in Firefox Nightly on Android (using web-ext)
  2. Go to about:debugging#/setup in Firefox Nightly on your computer and enable USB debugging
  3. To select your device, click connect
  4. Click inspect to open the about:devtools-toolbox then click Console
  5. Paste the following line: browser.tabs.query({}).then(e=> { console.log(e)})
  6. 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 avatar Aug 08 '22 18:08 artisticfox8

Also, the property is listed as supported at there as of version 54. So it is a regression

artisticfox8 avatar Aug 08 '22 20:08 artisticfox8

@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()

mcarare avatar Aug 10 '22 11:08 mcarare

@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

artisticfox8 avatar Aug 11 '22 21:08 artisticfox8

Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1812854

Change performed by the Move to Bugzilla add-on.

boek avatar Jan 26 '23 23:01 boek