Open Bug 1817809 Opened 2 years ago Updated 2 years ago

Support action.openPopup on Fenix (implement onOpenPopup override of ActionDelegate in A-C)

Categories

(Fenix :: WebExtensions, enhancement)

All
Android
enhancement

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

Details

(Whiteboard: [addons-jira])

Bug 1530402 introduced support for the browser/page action extension APIs. They have mostly been hooked up. One of the methods, the openPopup method has not correctly been hooked up in A-C, despite the method being supported in GeckoView (unit test: ExtensionActionTest.kt), and supported in TestRunnerActivity (source) and GVE (source).

This report shows the STR and provides guidance on supporting the functionality in A-C / Fenix.

Steps to reproduce

This can manually be confirmed on current Firefox for Android builds:

  1. Install uBlock Origin (that has a browserAction popup).
  2. Attach a debugger (enabling ADB debugging, enabling remote debugging in the Firefox app and then via about:debugging on desktop)
  3. Open any tab (e.g. example.com) to launch the Gecko process.
  4. Ensure that we can call browser.browserAction.openPopup. This currently requires a user gesture (until bug 1799344 removes that requirement). There are three ways to meet this requirement:
  • Set the extensions.openPopupWithoutUserGesture.enabled preference to true,
  • Or by opening an extension page, registering a click event listener and call the openPopup method from the click handler,
  • Inspect the extension and call browser.tabs.create({ url: browser.runtime.getURL("manifest.json") }) to open a new extension tab.
  • Inspect that tab in the devtools, and register the listener: document.body.onclick = () => { browser.browserAction.openPopup(); };.
  • Interact with the browser manually by tapping in the content area of the tab.
  1. Once you have enabled the openPopup API (step 4), open the popup by calling browser.browserAction.openPopup(); (e.g. via the devtools).

Expected behavior

  • The extension popup opens.

Actual behavior

  • Nothing happens.

Implementation details

To support it on Fenix:

Additional notes:

  • It would be really nice to be able to open the popup for arbitrary "windows" (tabs / GeckoSession), and not to assume it to be whatever the currently active tab is. That should be fixed along with bug 1817772 (see also: https://bugzilla.mozilla.org/show_bug.cgi?id=1795956#c1 ).
  • Not a must-have, but if possible, it would be nice to notify GeckoView/Gecko when the popup has finally been opened (to support bug 1811071).

This would be a good-first-bug for WebExtension engineers who are looking to contribute to Android-Components / Fenix.

Not a must-have, but if possible, it would be nice to notify GeckoView/Gecko when the popup has finally been opened (to support bug 1811071).

You need to log in before you can comment on or make changes to this bug.