Intent to Implement and Ship: Push userVisible and hasPermission()

121 views
Skip to first unread message

Peter Beverloo

unread,
Apr 17, 2015, 10:28:41 AM4/17/15
to blink-dev
Contact emails

Spec

Summary
Chrome currently supports the Push API, but requires developers to display a Web Notification in response to incoming messages. This is done by enforcing the existence of a “gcm_user_visible_only” key in the site’s manifest file.

This is a proprietary and prefixed solution, which was discussed in our previous Intent to Ship. Additionally, because we cannot access the manifest from within Service Workers, right now we have to assume that the developer’s intent is to only send push messages resulting in user visible UI.

We have introduced an optional dictionary having a “userVisible” key to the subscribe() method through which the developer can clarify their intent.

This key also allows us to explain the hasPermission() method accurately, which we therefore would like to ship.

Example
serviceWorkerRegistration.pushManager.subscribe({
    userVisible: true
}).then(...);

serviceWorkerRegistration.pushManager.hasPermission().then(...);

Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes - minus Android WebView because we don’t support the Push API there.

Compatibility Risk
Small. We are the only ones who ship the Push API, and this is a specified iteration on our implementation. Implementations which do not care about the value of userVisible will ignore it.

The Permission API already supports this option in the Push permission descriptor. We acknowledge that the hasPermission() method presents some overlap for this API, but consider this to be OK because (1) the API footprint is very small, and (2) it allows existing users of Push to avoid introducing a dependency on the Permission API, which other UAs could choose to deliver independently of Push.

We plan to deprecate the “gcm_user_visible_only” manifest key and will show a warning in the developer console when this is used, but not the userVisible key. Chrome 45 will remove support for the manifest key altogether.

OWP launch tracking bug?

Link to entry on the feature dashboard
None.

Anne van Kesteren

unread,
Apr 17, 2015, 11:09:17 AM4/17/15
to Peter Beverloo, blink-dev
On Fri, Apr 17, 2015 at 4:28 PM, Peter Beverloo <pe...@chromium.org> wrote:
> serviceWorkerRegistration.pushManager.hasPermission().then(...);

It seems weird for this API to not return a boolean while being called
hasPermission(). Shouldn't it be named similar to what we have for
notifications but instead be a method as it returns a fresh promise?
I.e. permission()?


--
https://annevankesteren.nl/

Michael van Ouwerkerk

unread,
Apr 17, 2015, 11:34:08 AM4/17/15
to Anne van Kesteren, Peter Beverloo, blink-dev
Anne, let's discuss the method name in this spec issue: https://github.com/w3c/push-api/issues/136

/m



To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Peter Beverloo

unread,
Apr 17, 2015, 12:10:45 PM4/17/15
to Michael van Ouwerkerk, Anne van Kesteren, blink-dev
We'll pursue the name change in the issue Michael referred to. Further feedback is most welcome of course.

I've filed an entry on the feature dashboard as well:

Thanks,
Peter

Chris Harrelson

unread,
Apr 17, 2015, 1:50:49 PM4/17/15
to Peter Beverloo, Michael van Ouwerkerk, Anne van Kesteren, blink-dev
userVisibleOnly sounds more clear to me. LGTM modulo that feedback.

Philip Jägenstedt

unread,
Apr 21, 2015, 11:30:12 AM4/21/15
to Chris Harrelson, Peter Beverloo, Michael van Ouwerkerk, Anne van Kesteren, blink-dev
LGTM2. It looks like discussions in https://github.com/w3c/push-api/issues/136 and https://github.com/slightlyoff/BackgroundSync/issues/39 are both ongoing, but it would be best if they were resolved by the people closest to the spec. If it remains in limbo so that there's a risk of this slipping a release, maybe ping this thread again.

Philip

Michael van Ouwerkerk

unread,
Apr 22, 2015, 1:28:08 PM4/22/15
to Philip Jägenstedt, Chris Harrelson, Peter Beverloo, Anne van Kesteren, blink-dev
An update on the naming: hasPermission() became permissionState() [1] and userVisible became userVisibleOnly [2].


Regards,

Michael

Peter Beverloo

unread,
Apr 28, 2015, 7:16:37 AM4/28/15
to Michael van Ouwerkerk, Philip Jägenstedt, Chris Harrelson, Anne van Kesteren, blink-dev
Miguel has since been landing the patches for propagating the rename in Blink and Chromium. Thank you for the feedback!

Are there any further concerns from the API owners? This Intent is still low one LGTM as well.

Thanks,
Peter

TAMURA, Kent

unread,
Apr 29, 2015, 11:20:16 PM4/29/15
to Peter Beverloo, Michael van Ouwerkerk, Philip Jägenstedt, Chris Harrelson, Anne van Kesteren, blink-dev
LGTM3

--
TAMURA Kent
Software Engineer, Google


Peter Beverloo

unread,
May 6, 2015, 1:42:22 PM5/6/15
to TAMURA, Kent, Philip Rogers, Michael van Ouwerkerk, Philip Jägenstedt, Chris Harrelson, Anne van Kesteren, blink-dev
Thank you!

I received some off-list feedback from Philip regarding this intent. Mozilla can live with the permissionState() name, and are, as expected, not impacted by the userVisible -> userVisibleOnly rename.

We'll go ahead and land the final few CLs now :-).

Thanks,
Peter
Reply all
Reply to author
Forward
0 new messages