8000 Expose pushManager on Window by annevk · Pull Request #393 · w3c/push-api · GitHub
[go: up one dir, main page]

Skip to content

Conversation

annevk
Copy link
Member
@annevk annevk commented Nov 19, 2024

This is part of the Declarative Web Push initiative (see #360) and mainly makes sense when that is supported, although could be independently supported in theory.

This makes window.pushManager work by making push subscriptions tied to a scope rather than a service worker registration. Most often push subscriptions remain 1:1 with service worker registrations, but the scope whose serialized path is "/" is treated specially from now on and can exist independently.

This obsoletes #368.

The following tasks have been completed:

  • Modified Web platform tests (link to pull request): N/A, except IDL coverage

Implementer support:

  • Chromium
  • Gecko
  • WebKit

Preview | Diff

This was referenced Nov 19, 2024
@saschanaz

This comment was marked as resolved.

@annevk annevk mentioned this pull request Dec 5, 2024
4 tasks
annevk added a commit that referenced this pull request Dec 5, 2024
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event).

In addition to showing a notification, the app badge can be updated as well.

This builds on whatwg/notifications#213 which adds URL members to notifications.

Exposing PushManager outside of service workers is handled by #393.
Copy link
Member
@saschanaz saschanaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first round of review. Looks mostly fine but with some questions.

</li>
<li>If |subscription| is null, then resolve |promise| with null.
</li>
<li>If there is an error with |subscription|, reject |promise| with a {{DOMException}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same about error, might be nicer if we throw in the obtaining steps or just skip this. It's unclear what a caller should do if this function throws, so maybe implementations should just pretend that no subscription exists if it's corrupted or something. If there's a good reason to throw error, it would be nice to have a note about that.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just trying to preserve existing text.

@saschanaz

This comment was marked as resolved.

annevk added a commit that referenced this pull request Mar 3, 2025
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event).

In addition to showing a notification, the app badge can be updated as well.

This builds on whatwg/notifications#213 which adds URL members to notifications.

Exposing PushManager outside of service workers is handled by #393.
annevk added a commit that referenced this pull request Jul 30, 2025
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event).

In addition to showing a notification, the app badge can be updated as well.

This builds on whatwg/notifications#213 which adds URL members to notifications.

Exposing PushManager outside of service workers is handled by #393.
This is part of the Declarative Web Push initiative (see #360).

This makes window.pushManager work by making push subscriptions tied to a scope rather than a service worker registration. Most often push subscriptions remain 1:1 with service worker registrations, but the scope whose serialized path is "/" is treated specially from now on and can exist independently.
@annevk annevk force-pushed the window-accessible-pushmanager branch from 6e463a7 to 895dd36 Compare August 6, 2025 14:43
@saschanaz saschanaz self-requested a review August 6, 2025 14:48
@saschanaz
Copy link
Member

A significant portion of this PR can be part of an editorial PR. I'll file a new one for them and merge it myself, for easier review here.

Copy link
Member
@saschanaz saschanaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a blocker, just a few editorial things. I'm fine with dealing with them in separate issues.

[=push subscription=].
If the <a>user agent</a> has to change the keys of a [=push subscription=] for any reason
and the [=push subscription=]'s [=associated service worker registration=] is non-null,
it MUST [=refresh=] the [=push subscription=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Might want to mention #401 in a note)

@saschanaz saschanaz closed this Sep 4, 2025
@saschanaz saschanaz reopened this Sep 4, 2025
@saschanaz
Copy link
Member
saschanaz commented Sep 4, 2025

Section 4 about security consideration has this:

When a service worker registration is unregistered, any associated push subscription MUST be deactivated.

We probably want to change that. (Either remove that or make it non-normative? Not sure why it should be defined again in a security section.)

Edit: Maybe the Subscription deactivation section should say MUST for deactivation after unregistration.

@annevk annevk merged commit db45a06 into gh-pages Sep 10, 2025
2 checks passed
@annevk annevk deleted the window-accessible-pushmanager branch September 10, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0