Clicking on a notification has no effect if background script in MV3 extension is suspended
Categories
(WebExtensions :: General, defect, P1)
Tracking
(firefox-esr128 fixed, firefox135 fixed)
People
(Reporter: alex, Assigned: robwu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(2 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-esr128+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Steps to reproduce:
If the user clicks on a notification from an MV3 extension while the background script is suspended, and an event handler is defined for the click action on the notification, nothing happens.
I have created an example MV3 extension that illustrates the problem. Full source code can be found here: https://github.com/aecreations/mv3-notification-demo
The extension manifest has notifications listed in the permissions key.
The browser.notifications.onClicked.addListener function is defined in the top-level of the background script, not inside a function or method.
Steps to reproduce:
- Clone the above GitHub repository to a folder on your local machine. Then launch Firefox Developer Edition and install the extension as a temporary add-on
- A notification should appear immediately upon installation. Do NOT click on it!
- Wait for the extension's background script to be suspended.
- Once the background script is suspended, click on the notification. On Windows, it can be found in the Action Center; on macOS, it can be found in the sidebar that appears when clicking on the date and time on the right-hand side of the desktop menu bar.
Actual results:
Clicking on the notification in step 4 has no effect.
Expected results:
Clicking on the notification in step 4 should open an extension page in a popup window.
The behaviour should be the same regardless of whether the notification was clicked as soon as it appeared, or later after the background script is suspended, in which case it should cause it to be restarted so that it can respond to the click action on the notification.
Comment 1•11 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Comment 2•11 months ago
|
||
Thanks for your report. I thought that we fixed this for all APIs, but apparently that is not the case:
https://searchfox.org/mozilla-central/rev/81ac0fe96e1bd6020408c2ae7eae6e5b5114d1db/toolkit/components/extensions/parent/ext-notifications.js#87
We should implement persistent listeners for notifications.
I wondered whethere there are other cases we overlooked, and I checked all results for events without ExtensionAPIPersistent super class nor a special primeListeners at https://searchfox.org/mozilla-central/search?q=class+extends+ExtensionAPI+%7B&path=parent%2F&case=false®exp=false
Out of all, we only have the privileged-only geckoProfiler that does not have a method override: https://searchfox.org/mozilla-central/rev/81ac0fe96e1bd6020408c2ae7eae6e5b5114d1db/toolkit/components/extensions/parent/ext-geckoProfiler.js#71
Updated•11 months ago
|
| Assignee | ||
Comment 3•11 months ago
|
||
I'm going to fix this since the notifications API is one of the most popular APIs among extensions, and not waking up the event page is disruptive to the functionality of extensions depending on this.
I am also going to request uplifts, at least for ESR128.
| Assignee | ||
Comment 4•10 months ago
|
||
Comment 6•10 months ago
|
||
| bugherder | ||
| Assignee | ||
Comment 7•10 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D232859
Updated•10 months ago
|
Comment 8•10 months ago
|
||
esr128 Uplift Approval Request
- User impact if declined: User interactions with extension notifications may fail to be detected by the extension. The affected extension or browser may be perceived as non-responsive/buggy.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Manual QA not needed, fully covered by automated tests
- Risk associated with taking this patch: Low
- Explanation of risk level: Issue well understood, and fix is very targeted and covered by unit tests.
- String changes made/needed: none
- Is Android affected?: yes
Updated•10 months ago
|
Updated•10 months ago
|
Comment 9•10 months ago
|
||
Comment on attachment 9445236 [details]
Bug 1932263 - Support persistent listeners in notifications API
This needs rebasing for ESR128.
Updated•10 months ago
|
Updated•10 months ago
|
| Assignee | ||
Comment 10•10 months ago
|
||
Rebased for ESR128. Merge conflict was caused by bug 1901282 (https://hg.mozilla.org/mozilla-central/rev/1d375c0daabb37a3d846fe0ff3edcc3a5edc50e3).
| Assignee | ||
Updated•9 months ago
|
Comment 11•9 months ago
|
||
| uplift | ||
Updated•9 months ago
|
Updated•9 months ago
|
Description
•