Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should persistent notifications be associated with service worker registration or the scope? #205

Open
saschanaz opened this issue Feb 23, 2024 · 2 comments

Comments

@saschanaz
Copy link
Member

saschanaz commented Feb 23, 2024

What is the issue with the Notifications API Standard?

I just found that both Firefox and Safari associate the notifications with the scope instead for getNotifications(), while the spec says:

https://notifications.spec.whatwg.org/#dom-serviceworkerregistration-getnotifications

Let notifications be a list of all notifications in the list of notifications whose origin is same origin with origin, whose service worker registration is this, and whose tag, if tag is not the empty string, is tag.

Blink does the association as the spec says, and closes all the notifications when the SW is unregistered. I'm adding a tentative test in https://phabricator.services.mozilla.com/D202612 for Gecko/WebKit behavior as that's the majority, but worth a discussion.

@asutherland
Copy link

I think registration is correct. Arguably the current use of registration allows the spec to hand-wave the lack of steps like the push API's deactivation text.

Given the removal of registration resurrection from the SW spec, and because the SW job queue mechanism does operate in terms of scopes, specifying persistent notification in terms of scope I think ends up much more constraining for implementations because notifications would inherently need to run a set of steps as part of the ServiceWorker unregister job. (Although I suppose this is already the case for push citing registration clearing.)

That said, I think the notifications spec could benefit from additional clarity like the push deactivation text.

@asutherland
Copy link

Also I should note that w3c/ServiceWorker#1512 would potentially decouple scopes from registrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants