Extension popups not closed when the extension unloads on Android
Categories
(Firefox for Android :: WebExtensions, defect)
Tracking
()
People
(Reporter: robwu, Unassigned)
References
Details
On desktop Firefox, unloading an extension closes the extension popup:
- browserAction: https://searchfox.org/firefox-main/rev/a4d90d145864bee938bb23cb2684d64bff032431/browser/components/extensions/parent/ext-browserAction.js#170-172
- pageAction: https://searchfox.org/firefox-main/rev/a4d90d145864bee938bb23cb2684d64bff032431/browser/components/extensions/parent/ext-pageAction.js#181
on Android, such logic is absent. There is nothing actively checking and removing extension popups on Android.
When I manually tested the behavior on Fenix, I can confirm that the popup persists even after extension uninstallation:
- On Firefox for Android, enable USB debugging, and install uBlock Origin (or any other extension that has an extension popup).
- On Firefox for Android, click on the extension button to open uBlock Origin's popup panel.
- On desktop Firefox, visit
about:debugging. Inspect the extension. Run the following code snippet:browser.management.uninstallSelf() - Look at Firefox for Android.
Expected:
- The popup should have closed.
Actual:
- The popup is still around.
I noticed this while working on bug 1799347: ./mach test toolkit/components/extensions/test/mochitest/test_ext_browserAction_openPopup.html timed out, with logcat showing that the test extension threw openPopup() cannot be called while another panel is open (this check is newly introduced in bug 1799347). The error happens because earlier in the test, openPopup() is called to open the extension panel, but never closed. As a work-around to this bug, I invoking a test-specific helper (AppTestDelegate.closeBrowserAction) to close the popup. But that should not have been necessary.
| Reporter | ||
Comment 1•8 hours ago
|
||
There are multiple tests that call action.openPopup() in toolkit/components/extensions/test/mochitest/. Any of these tests will now fail if there is an unexpected extension popup present (due to the check added in bug 1799347). This also implies that if any extension opened an action popup window, that all other tests in the same test manifest will fail. I observed that in CI and locally.
Note that the test delegates that open the popup in mochitests, implemented in TestRunnerActivity maintain a mPopupSession member with the expectation of it accurately reflecting the One And Only Popup session. This logic falls apart when the popup lifecycle is controlled by Gecko (e.g. an extension calling window.close()). This is a test-only helper not affecting users, but good to keep in mind when we implement openPopup() support in Fenix (that does not work right now due to bug 1817809).
Description
•