Open Bug 1782389 Opened 2 years ago Updated 1 year ago

tabs.create({}) behaviour different on Android than on desktop

Categories

(GeckoView :: Extensions, defect, P2)

All
Android

Tracking

(Not tracked)

People

(Reporter: kbrosnan, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [addons-jira])

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

Steps to reproduce

  1. Download tabs tabs tabs example addon from https://github.com/mdn/webextensions-examples/tree/master/tabs-tabs-tabs
  2. Modify the code in tabs.js from
  else if (e.target.id === "tabs-create") {
    browser.tabs.create({url: "https://developer.mozilla.org/en-US/Add-ons/WebExtensions"});
  }

to

  else if (e.target.id === "tabs-create") {
    browser.tabs.create({});
  }
  1. Load the addon in about:debugging in Firefox Nightly on Windows 10
  2. Open the addon popup and click create a tab
  3. The browser.tabs.create({}); line opens the same tab the ctrl t does, the new tab page
  4. Now load the addon in Firefox Nightly on Android
  5. Open the addon popup and click create a tab
  6. Here is the bug: browser.tabs.create({}); line opens about:blank

In my opinion, Firefox Android should be consistent with the desktop Firefox.
Desktop Firefox adheres to the spec:

url string. The URL to navigate the tab to initially. Defaults to the New Tab Page.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create

Expected behaviour

The browser.tabs.create({}); line opens the same tab the ctrl t does, the new tab page

Actual behaviour

Here is the bug: browser.tabs.create({}); line opens about:blank

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.

Rob, is this tabs.create({}) bug on Android a known issue? Is there a duplicate bug already filed?

Severity: -- → S3
Flags: needinfo?(rob)
Summary: [Bug]: tabs.create({}) behaviour different than on desktop → tabs.create({}) behaviour different on Android than on desktop

On Firefox for Android (Fenix), the "new tab" is not actually a tab from GeckoView, but some view from A-C itself. For comparison, on desktop the opened tab is about:newtab or about:privatebrowsing.

That "tab" is not visible to the extension API (e.g. bug 1583281), and therefore the requested feature here can currently not be implemented.
So to fix this bug, we need two things:

  • GeckoView needs to be able to open the default tab. Ideally also the private browsing version of the new tab when desired (currently not possible - bug 1372178).
  • GeckoView should offer access to a (list of) tab(s) that hasn't actually got a corresponding loaded <browser> on the gecko side (bug 1583281).
    An alternative to this second requirement is to implement the first by supporting about:newtab and about:privatebrowsing URLs.

Opening about:blank is the closest feasible option available, which is also what we're doing at https://searchfox.org/mozilla-central/rev/db4b1d66c4b409bdbce43f3f3498401f5303d961/mobile/android/components/extensions/ext-tabs.js#393

Flags: needinfo?(rob)
See Also: → 1583281, 1372178

None of Fenix's recommended extensions use this API now, but we'd like to fix it before GA.

Priority: -- → P2
Whiteboard: [addons-jira]
Depends on: 1817806
You need to log in before you can comment on or make changes to this bug.