Skip to content

Add Declarative Web Push - #385

Merged
annevk merged 9 commits into
gh-pagesfrom
declarative-push
Aug 6, 2025
Merged

annevk merged 9 commits into
gh-pagesfrom
declarative-push

Conversation

@annevk

@annevk annevk commented Aug 26, 2024 •

Copy link
Copy Markdown
Member

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).

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

Exposing PushManager outside of service workers is #393.


The following tasks have been completed:

  • Modified Web platform tests (link to pull request): IDL will be tested, but otherwise there's no good infrastructure for this as-of-yet.

Implementer support:

  • Chromium (has indicated support at times)
  • Gecko
  • WebKit

Preview | Diff

@martinthomson martinthomson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like to see more explanatory text attached to this sort of change. (In the spec, not the PR, for avoidance of doubt.)

From what I can see, a message is opportunistically parsed as JSON. If it parses and there is a "web_push": 9001 (?!) attribute, the browser attempts to make a notification. If that works, the notification is shown.

There is also a mutable attribute attached, which would allow the SW the option of intercepting the notification and tweaking it before it is shown. That would somewhat negate the benefits from a purely declarative notification, so it seems an unnecessary feature (the app could save the "web_push": 9001 bytes and just make a notification for itself).

Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved

@saschanaz saschanaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we split mutable out of this PR for now?

Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved

@saschanaz saschanaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly fine with a few changes. We explicitly did not cover the app badge part of this PR though.

Comment thread index.html Resolved
Comment thread index.html
</li>
<li>
<p>
Let |declarativeResult| be the result of running the [=/declarative push message

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This happens after "If |registration| is not found, abort these steps." step above. Either #393 or this PR should fix that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would suggest we fix that in #393. And we merge this first.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wfm.

Comment thread index.html Resolved
Comment thread index.html Resolved
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
annevk force-pushed the declarative-push branch from a64358c to d44656e Compare July 30, 2025 15:43
@annevk annevk mentioned this pull request Jul 30, 2025
1 of 4 tasks
@saschanaz

Copy link
Copy Markdown
Member

Force push breaks "Changes since your last review" feature 😵

@annevk

annevk commented Jul 30, 2025

Copy link
Copy Markdown
Member Author

I made 7551a5f and a64358c before I squashed (to create the copy PR for app badge). Both super tiny commits. Removal of app badge is a separate commit again.

@saschanaz saschanaz left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can check Mozilla on the interest list. (Or well, I did)

@saschanaz

saschanaz commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

Looking at WebKit/WebKit#18087, it seems WebKit shipped "pushnotification" event instead of reusing existing "push" event, deviating from this PR? 🤔

(Edit: Or WebKit changed it to "push" but the remnant of "pushnotification" is still in the source?)

Filed https://bugs.webkit.org/show_bug.cgi?id=296772

@saschanaz

saschanaz commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

@annevk

annevk commented Aug 4, 2025

Copy link
Copy Markdown
Member Author

Thanks for finding those bugs, we'll get them fixed!

@annevk
annevk merged commit 54d5cb1 into gh-pages Aug 6, 2025
@annevk
annevk deleted the declarative-push branch August 6, 2025 14:14
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.

7 participants