Intent to Ship: ServiceWorker's WindowClient interface / Clients.openWindow() / ServiceWorkerRegistration in SW scope

Skip to first unread message

Mounir Lamouri

Feb 6, 2015, 11:55:25 AM2/6/15
to, Kenji Baheux,
Contact emails:
- (WindowClient / Clients.openWindow)
- (ServiceWorkerRegistration in SW scope)
- (PM)


This intent to ship exposes several new methods,interfaces and
- Addition of the WindowClient interface. It reflects some properties of
the Client like visibilityState, focused and frameType;
- Ability for a ServiceWorker to focus() a WindowClient;
- Ability for a ServiceWorker to openWindow();
- Expose ServiceWorkerRegistration in the ServiceWorkerGlobalScope.

All these capabilities are meant to support use cases for Notifications;
when a notification is clicked, a ServiceWorker might want to check
which pages are opened, focus() it if one is opened but not focused or
create a new one if none.
ServiceWorkerRegistration allows APIs that are hooked to the
registration object to be usable from a ServiceWorker (like Push or

Annoyance/Security considerations:
Focusing or opening a window from a ServiceWorker can be confusing or
even a security threat with regards to opening new windows. In order to
mitigate this concerns the following restrictions will apply to focus()
and openWindow()
- these methods can only be called in a notification click handler;
- only one call (either focus() or openWindow()) will be allowed per
notification click;
- event.waitUntil() will allow to delay the call in case some data needs
to be fetched;
- there is a 10 second limit between the time the event was sent and the
time one can call focus()/openWindow();
- openWindow() must be same-origin (it can open an uncontrolled window

Is this feature supported on all six Blink platforms (Windows, Mac,
Linux, Chrome OS, Android, and Android WebView)?
- WebView: ServiceWorkerRegistration should have the same level as
support as usual SW features. openWindow() and focus() should not work
(see the Notifications intent to ship). Generally speaking ServiceWorker
is not fully supported on WebView;
- Android: peter@ is finishing the implementation there;
- Everything else: Yes

Demo link (requires top of tree and experimental flag):
- very basic page demoing only those features on top of Notifications:
- fully featured website with Push/Notifications using these features:

Usual ServiceWorker debug tools should be enough to debug this feature
(chrome://inspect and chrome://serviceworker-internals).
In addition, if focus() or openWindow() are rejected, an error message
explains the reason why it happened.

Compatibility Risk:;
+ Jake Archibald (Google) worked closely with Anne van Kesteren
(Mozilla) on the spec changes.
+ There have been a few iterations and there is a general agreement on
the additions we are making.
+ There are test harness tests for all those features.
- First to ship;
- For openWindow() and focus() these tests will have to be run as manual
tests by other vendors because they use our own test tools (no other
- openWindow() can't open cross origins windows even if allowed by the
spec, we will work to loosen this restriction.

OWP launch tracking bug:

Link to entry on the feature dashboard:
Service Worker generic entry:

Thanks to michaeln@, jochen@, mkwst@, dominicc@, creis@ for the reviews.
Thanks to jsbell@ for doing a first prototype of openWindow(). Thanks to
peter@ for doing the window opening implementation on Android. Thanks to
jakearchibald@ for his amazing spec work and support.

-- Mounir

Kenji Baheux

Feb 6, 2015, 1:25:47 PM2/6/15
Sorry everyone for the mis-communication, here is the intent to ship we intended to send (has a few extra details and positioned as an enabler for Push and Notifications with links to the relevant intents).

I should have had an intent to send intent to ship plan :) 

Alex Russell

Feb 6, 2015, 7:26:16 PM2/6/15
to Kenji Baheux, Hiroki Nakagawa, blink-dev

As an enabler for end-to-end push/notification flows, this couldn't be more important. Very excited by this. Make it so!

To unsubscribe from this group and stop receiving emails from it, send an email to
Reply all
Reply to author
0 new messages