tabs.create() with "active:false" opens tab in foreground instead of background
Categories
(Firefox for Android :: WebExtensions, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
Steps to reproduce
- Install any extension on Fenix, e.g. uBlock Origin.
- Use
about:debuggingon desktop to inspect the app. - Inspect the extension and run
browser.tabs.create({ active: false });
Expected behavior
Should open a tab in the background (this is intentionally just a blank tab, not the tab that you see when you use the UI to open a new tab - bug 1782389).
Actual behavior
Opens a tab in the foreground.
Device information
- Firefox version: 151
- Android device model:
- Android OS version:
Any additional information?
The active flag propagates all the way from Gecko, through GeckoView to A-C, but then hits a hurdle in openTab in WebExtensionSupport.kt. When onNewTabOverride is set, it is called, and then onSelectTabOverride is called if needed (if selected is true, which takes its value from the active flag we initially passed).
But the onNewTabOverride does not receive the selected flag. In fact, its implementation unconditionally passed selectTab = true when it calls tabsUseCases.addTab: https://searchfox.org/firefox-main/rev/8b3456fa29ad35f58da4cc0a1d182e039124ba5d/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt#839-846
Other onNewTabOverrides implementations in the code base have a similar problem.
I think that the bug could be fixed by forwarding the selectTab flag as needed.
| Assignee | ||
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Comment 1•3 months ago
|
||
Updated•2 months ago
|
Comment 3•2 months ago
|
||
| bugherder | ||
Description
•