[whatwg] The behaviour of Notification.requestPermission() in Workers

Hello,

There has been considerable interest in exposing the Notification API on
workers, and especially service workers. The behaviour of
Notification.requestPermission() requires some consensus. The problem of
requestPermission() on workers is that the user agent may not always be in
a position to present UI to the user. The worker may be started on a page
that is not the active tab, the worker may be a service worker running in
the background, or it may be a shared worker with no single window with
which to associate UI (related [1]).

The easiest solution for implementors and authors is to make the
requestPermission() call in a HTML page before spawning a worker or
registering a service worker. Inside the Worker scope we then have two
options:
1) requestPermission() is not defined.
2) requestPermission() does not ask the user, but uses the permission
associated with that origin, or denied.

I believe option 2 is better in terms of having a complete API.

Feedback is appreciated about what the right approach should be.

Regards,
Nikhil

[1]:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-March/039311.html

Received on Thursday, 24 October 2013 01:19:57 UTC