Clicking notification without an awake service worker always opens a new window with the root path of the origin (on Windows) or does nothing (on Android)
Categories
(Core :: DOM: Notifications, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox142 | --- | fixed |
People
(Reporter: saschanaz, Assigned: saschanaz)
References
Details
Attachments
(2 files, 4 obsolete files)
What we currently do is just opening the origin; e.g. https://app.slack.com for all Slack notifications. We do not trigger notificationclick event on service worker, but we should.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
So, the code path differs quite from bug 1874511 because we can't depend on Activated event in this case.
- Windows invokes the Firefox notification server as described in
launchArggenerated from ToastNotificationHandler::GetLaunchArgument. This includes host/port pair vialaunchUrlgenerated by ToastNotificationHandler::ActionArgsJSONString, which then is served asactionparameter. - The server then again invokes Firefox with
--notification-windowsAction. - BrowserContentHandler calls handleWindowsTag, which fails with
tagWasHandled: falseasToastNotification::VerifyTagPresentOrFallbackfails to find any match withmActiveHandlers, which is currently only initiated byToastNotification::ShowAlert. - The failure fallback either opens a tab or a new window with
notificationData.launchUrldepending on the current browser state.
(These steps actually happen for both cases per the comment, but is ignored when tag is handled. Or not, see bug 1880863.)
I think we need to reload notification handlers from the notification DB, as I don't think that's happening right now. Each notification in DB has alertName for unique match.
| Assignee | ||
Updated•1 year ago
|
Would you please remove the "when the browser is closed" from the title? Since there seem to be no conditions at all where it Does run the service worker.
| Assignee | ||
Comment 3•1 year ago
|
||
"Notification click" is the condition, but sure I can clarify.
| Assignee | ||
Comment 4•1 year ago
|
||
Actually this is a defect, so rephrasing the title again to match that.
That new title places this even farther from the issue I reported which was referred here in bug 1874511, comment 8
I Never click notifications when the browser is closed, it's always open, and clicking them when it's open Always goes to the front page (the main domain) instead of the correct address (as mentioned in comment 0 here) if it goes anywhere at all. Not going anywhere is covered now by bug 1874511.
Including 'when closed' in the title narrows the scope way smaller than the issue is. It's a major user facing problem which significantly reduces the utility of the browser.
Unless I'm the only one seeing this? I have a few extensions but it's a relatively new profile.
| Assignee | ||
Comment 6•1 year ago
|
||
If it always fails then we need more info, can you try:
- Open https://simple-push-demo.vercel.app/
- Enable push
- Click "Send a push message" immediately when notification shows
Clicking it should open https://web.dev/articles/push-notifications-overview .
Very interesting. I restarted the browser for an update a few days ago and when it came back this issue didn't happen - it started going to the correct page for every notification that opened at all, including that test page. I'll keep an eye on it, it seems like it's either not the 100% repro I was seeing before or it's been fixed entirely (while open. I still haven't tested the closed case.)
I'll keep the needsinfo on while I monitor the behavior.
Sorry I didn't get back to you about this. I have seen it happen (when the browser is open) just a few times since then, but it's also difficult to test now because Bug 1874511 is such a common repro.
So it still happens, but rarely anymore.
Comment 9•1 year ago
|
||
Do we have enough information to set the severity here? Thank you!
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Comment 10•1 year ago
|
||
krosylight: my WNS PoC ends up invoking notifyPushWithData at about the same place where native notifications are handled.
It might be possible to arrange for some Web Push specific data to round-trip through the toast notification system to support this use case, if you'd like it to. The issue might be identifying when a toast notification "originates" from a Web Push -- but I think that's more or less always here. Food for thought.
| Assignee | ||
Comment 12•1 year ago
•
|
||
It should be possible to pass a service worker identifier to each notification so that the command would include it as a parameter. I'm not quite sure we should do that, because:
- I'm not sure it's exactly safe, as some malware could scan the notification center and craft a command with the identifier to mock a user click, which then would run JS with malware crafted arguments. But maybe we can't do much for such an infected machine, as there would be hundreds more evil things to do for a malware?
- Do we know the same can be done for Linux and macOS, i.e. can we store the same amount of information into libnotify and macOS notification system?
- Can you share how you did it for Windows? Bug 1803416 only has the proxy binary part, and per my understanding we hash the information here to fit the system limitation. My plan was to use this hashed tag everywhere (in other backends and notification store), but open for better ideas!
Please feel free to correct me if I got something wrong 👍🏻
Comment 13•10 months ago
|
||
Just a quick update that since Bug 1874511 was fixed, this one has taken over as the main thing that happens when a notification is clicked. (Unless the browser was just recently restarted). It's no longer in any way a rare occurrence.
| Assignee | ||
Updated•9 months ago
|
| Assignee | ||
Comment 15•7 months ago
|
||
Ultimately showNotification() should be able to directly call NotificationManager without having to go through PNotification and the full blown NotificationObserver.
| Assignee | ||
Comment 16•7 months ago
|
||
| Assignee | ||
Comment 17•7 months ago
|
||
| Assignee | ||
Comment 18•7 months ago
|
||
Requested in D236586. This is just a pure code style change for easier review, migration will happen in the next patch.
| Assignee | ||
Comment 19•7 months ago
|
||
Updated•6 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
| Assignee | ||
Comment 20•6 months ago
|
||
| Assignee | ||
Comment 21•6 months ago
•
|
||
Answering Gijs' question in https://phabricator.services.mozilla.com/D250061#inline-1394374:
./mach run --notification-windowsTag=foo --notification-windowsAction='{"origin": "https://example.org"}' is a way to simulate the notification click command. With the current patch stack,
- It opens a startup window
- And then opens a new browser window for example.org
- But the window at step 1 remains, being totally blank with no UI at all
What we can do:
- Somehow figure it out how to reuse the startup window
- Just start a full browser and open a new tab in the existing window
I'm leaning to 2 because:
- It's easier
- Aligns with existing commandline handler behavior - Running
firefox https://example.comwhen there's only Library window also kickstarts a new browser window and then opens the webpage, restoring the previous session if the option is enabled
What do you think? Depending on the answer I'll also need to adjust the patches in bug 1218080.
(Edit: Actually the current bug 1218080 also effectively does 2 with optional session restore. Cool, I'll double check if this is the case for this bug too.)
| Assignee | ||
Comment 22•6 months ago
|
||
Ok, no need to even ask, I'll do that path. The current behavior sounds just wrong.
| Assignee | ||
Comment 23•6 months ago
|
||
What I don't understand is, why bug 1218080 can do the session restore while this bug cannot? Both depend on the same function OpenNewWindow added in bug 1218080 🤔
Comment 24•6 months ago
|
||
Comment on attachment 9488745 [details]
Bug 1847096 - Part 4: Split handleNotification from nsDefaultCommandLineHandler.handle r=gijs
Revision D250060 was moved to bug 1974234. Setting attachment 9488745 [details] to obsolete.
Comment 25•5 months ago
|
||
Comment 26•5 months ago
|
||
Comment 27•5 months ago
|
||
Backed out for causing build bustages @NotificationParent.cpp and @NotificationHandler.h.
- Backout link
- Push with failures
- Failure Log @NotificationParent.cpp
- Failure Log @NotificationHandler.h.
Comment 28•5 months ago
|
||
| Assignee | ||
Updated•5 months ago
|
Comment 29•5 months ago
|
||
Comment 30•5 months ago
|
||
Backed out for causing wpt failures.
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-ERROR | /_mozilla/notifications/simulate-click-handler.sub.https.window.html | 1 duplicate test name: "Fire notificationclick via NotificationHandler"
Comment 31•5 months ago
|
||
| Assignee | ||
Updated•5 months ago
|
Comment 32•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a88fbd78190d
https://hg.mozilla.org/mozilla-central/rev/0d634bf7b3a8
https://hg.mozilla.org/mozilla-central/rev/dcdce87f5be9
Comment 33•5 months ago
|
||
Comment on attachment 9488746 [details]
Bug 1847096 - Part 5: Use NotificationHandler in BrowserContentHandler r=gijs
Revision D250061 was moved to bug 1976474. Setting attachment 9488746 [details] to obsolete.
Updated•5 months ago
|
Updated•5 months ago
|
Description
•