Open Bug 1812854 Opened 3 years ago Updated 7 months ago

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

Categories

(Firefox for Android :: WebExtensions, defect)

All
Android
defect

Tracking

()

People

(Reporter: boek, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

From github: https://github.com/mozilla-mobile/fenix/issues/26369.

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

Change performed by the Move to Bugzilla add-on.

Severity: -- → S3

"Currently, every "tab" on Fenix is in its own window." - https://bugzilla.mozilla.org/show_bug.cgi?id=1372178#c7

We'd need to properly support the concept of multiple tabs grouped together before we can meaningfully export index != 0. The concept of "multiple tabs together" is also a prerequisite for bug 1817772.

And bug 1583281 is also needed - the extension API internals need to be aware of non-loaded tabs before a meaningful index can be exposed.

Blocks: 1817791, 1543755
Depends on: 1583281
See Also: → 1817772
See Also: → 1906411
You need to log in before you can comment on or make changes to this bug.