w3c / push-api

Push API
https://w3c.github.io/push-api/
Other
144 stars 40 forks source link

check and consume user activation #348

Open marcoscaceres opened 2 years ago

marcoscaceres commented 2 years ago

Closes #346

The following tasks have been completed:

Implementation commitment:


Preview | Diff

marcoscaceres commented 2 years ago

Preparing a WPTest...

beverloo commented 2 years ago

I'm not sure this is Web compatible -

  1. subscribe() can be called from within a service worker, where there are no local activations that can be consumed -- particularly the consume user activation steps assume that there's a window.
  2. Looking at our metrics, only about a fourth of permission requests happen with a gesture. We mitigate against this by displaying a different user interface (if any at all) in those cases. In my reading it would be valid for an implementation not to show any prompt at all.
saschanaz commented 10 months ago

Note that Gecko opted to require user activation only if the permission is not granted, and just proceeds without activation if it's granted, which I think is the best way as reportedly some websites repeatedly calls pushManager.subscribe() every time: https://bugzilla.mozilla.org/show_bug.cgi?id=1486010#c5

Instead, the page calls pushManager.subscribe every time you visit it

marcoscaceres commented 7 months ago

I'll take a closer look at what WebKit does... we might be doing something similar @saschanaz.