Add NotificationObserver to keep handlers alive for backends without persistence support
Categories
(Core :: DOM: Notifications, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox138 | --- | fixed |
People
(Reporter: saschanaz, Assigned: saschanaz)
References
(Blocks 3 open bugs)
Details
Attachments
(2 files)
Currently Firefox closes push notifications when either the page or service worker goes away on Linux and macOS. We should keep them alive at least until Firefox process is closed, and for that there should be an entity that can outlive PNotification.
(Keeping handlers registered regardless of PNotification lifecycle would let notifications alive, but Alert Service alone can't and shouldn't handle service workers)
Assignee | ||
Comment 1•21 days ago
|
||
Mostly became redundant after IPC migration or even before that.
Assignee | ||
Comment 2•21 days ago
|
||
Updated•17 days ago
|
Assignee | ||
Updated•16 days ago
|
Assignee | ||
Updated•16 days ago
|
Comment 4•16 days ago
|
||
bugherder |
Assignee | ||
Updated•16 days ago
|
Comment 6•15 days ago
|
||
bugherder |
Backed out for causing leaks @ browser/browser.toml
Comment 8•14 days ago
|
||
Backout merge to mozilla central: https://hg.mozilla.org/mozilla-central/rev/c84b2ed3f5b0bac47df6081736413822e08b8ff3
Assignee | ||
Comment 9•14 days ago
|
||
macOS specific because Windows and Linux counterparts listen to quit-application and clean things up. This should probably be done by nsAlertsService than on each system service.
Assignee | ||
Comment 10•14 days ago
|
||
(But technically it should be an existing problem)
Assignee | ||
Comment 11•13 days ago
•
|
||
So bug 1953906 can fix the issue in comment #7, but the real implication here is that the observer holds nsIPrincipal forever until the notification closes. That sounds bad, and maybe PrincipalInfo can be used to not do that? Thoughts?
Comment 12•13 days ago
|
||
We want to get rid of PrincipalInfo in favor of only ever holding nsIPrincipals. I hadn't appreciated that we might not be properly handling shutdown for notifications since that was more on the toolkit side from my perspective, but we should be handling shutdown.
Assignee | ||
Comment 13•13 days ago
|
||
Sure we should handle shutdown, but shouldn't we also prevent holding principals too long? Especially when holding principal also means holding windows and potentially make another ghost window issue.
Comment hidden (obsolete) |
Comment 15•12 days ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #13)
Sure we should handle shutdown, but shouldn't we also prevent holding principals too long? Especially when holding principal also means holding windows and potentially make another ghost window issue.
Can you elaborate on the ownership chain you are describing as it relates to comment 7, in particular if you're referring to a specific log and specific contents in it if you could provide a log viewer URL with the lines selected? If I look at the fields in ContentPrincipal I see how we can entrain atoms but I don't see how we can entrain windows. (That said there obviously are ways for a DOM binding that's not a GlobalTeardownObserver but depends on CC and could be part of a non-CC'ed graph if the observer service is also holding a strong ref.)
Assignee | ||
Comment 16•12 days ago
|
||
Per https://treeherder.mozilla.org/logviewer?job_id=498742864&repo=autoland&lineNumber=28189 it leaks dom/notification/test/browser/empty.html
which the affected test uses, which IMO should not happen even if the observer leaks, as the observer should not hold the window in any way. It's unclear to me how that can happen either.
Assignee | ||
Comment 17•12 days ago
|
||
But perhaps that's just a red herring? 🤔
Assignee | ||
Comment 18•7 days ago
|
||
Per the private chat with :asuth, it seems the leak is because of the observer being XPConnect wrapper and thus references JSRuntime. I'd have never imagined that, thanks Andrew!
Comment 19•6 days ago
|
||
Comment 20•5 days ago
|
||
bugherder |
Description
•