Closed Bug 2040387 Opened 3 months ago Closed 2 months ago

tabs.create() with "active:false" opens tab in foreground instead of background

Categories

(Firefox for Android :: WebExtensions, defect, P1)

All
Android
defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

Steps to reproduce

  1. Install any extension on Fenix, e.g. uBlock Origin.
  2. Use about:debugging on desktop to inspect the app.
  3. 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.

See Also: → 1810841
Assignee: nobody → rob
Whiteboard: [addons-jira]
Severity: -- → S3
Priority: -- → P1
Pushed by rob@robwu.nl: https://github.com/mozilla-firefox/firefox/commit/378d796c1b33 https://hg.mozilla.org/integration/autoland/rev/daf8237a039f Forward tabs.create's active flag to onNewTabOverride r=android-reviewers,android-addons-reviewers,willdurand,marcin
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: