[whatwg] Notifications: in workers

Andrew Wilson atwilson at google.com
Tue May 14 08:51:15 PDT 2013

Sorry, missed this the first time through:

On Sun, Mar 31, 2013 at 4:40 PM, Anne van Kesteren <annevk at annevk.nl> wrote:

> There is some interest in exposing Notification objects in a worker so
> creating one does not require a postMessage() roundtrip.
> This seems problematic for shared workers as it is not clear which
> window the notification would be for. For normal workers this seems
> like less of a concern.

Not sure what you mean - why does it matter which window the notification
is for? Maybe this is only important for the permission prompt, but not for
the notifications themselves which live outside any specific window?

> If we go with the idea of exposing a URL on Notification objects and
> allow that to be set we might be able to address the shared worker
> issue, but it is not entirely clear to me which semantics are
> desirable there.
> Maybe if we made it a URL prefix it could work. E.g. you create a
> notification with a URL http://example.org/mail/ If that origin is
> allowed to display notifications that will all go well.

SharedWorkers already have an inherent domain, inherited from their
creating documents, correct? Why would we need to specify one when creating

> If there's a
> window open with that URL as prefix it can be focused once the user
> activates the notification. If there's no window open a window can be
> opened with that URL (no longer a prefix in this scenario). However,
> if there's several windows with that URL it's not clear what the best
> way would be. The last window the user interacted with maybe?
Not sure what you mean - are you expecting clicks on a notification to
focus the initiating window (I don't see this behavior described in the
notification spec)? Typically, this would be done via an onclick() handler,
so in that case it would be up to the SharedWorker to proxy that event to a
window if it wanted to focus one and not something the browser itself would

I feel like I'm misunderstanding the proposal though - sorry if I'm missing
some context here.

> --
> http://annevankesteren.nl/

More information about the whatwg mailing list