blob: 0855d6cc05b888f5442fc43db3f79ed9d11747a0 [file] [log] [blame]
<!DOCTYPE html>
<title>Service Workers: navigator.serviceWorker</title>
<link rel="help" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
The `serviceWorker` attribute of the [Navigator][1] interface must return an
instance of the `ServiceWorkerContainer` interface, which provides access to
registration, removal, upgrade, and communication with Service Workers that are
(or will become) active for the current document. Communication with these
workers is provided via standard [HTML5 messaging APIs][2], and [messaging
occurs as per usual with Web Workers][3].
<script type=text/plain id="idl_0">
partial interface Navigator {
readonly attribute ServiceWorkerContainer serviceWorker;
interface ServiceWorkerContainer : EventTarget {
[Unforgeable] readonly attribute ServiceWorker? installing;
[Unforgeable] readonly attribute ServiceWorker? waiting;
[Unforgeable] readonly attribute ServiceWorker? active;
[Unforgeable] readonly attribute ServiceWorker? controller;
readonly attribute Promise<ServiceWorker> ready;
Promise<sequence<ServiceWorker>?> getAll();
Promise<ServiceWorker> register(DOMString url, optional RegistrationOptionList options);
Promise<any> unregister(DOMString? scope);
// events
attribute EventHandler onupdatefound;
attribute EventHandler oncontrollerchange;
attribute EventHandler onreloadpage;
attribute EventHandler onerror;
dictionary RegistrationOptionList {
DOMString scope = "/*";
interface ReloadPageEvent : Event {
void waitUntil(Promise<any> f);
<script type=text/plain id="untested_idls">
interface ServiceWorker {};
interface EventHandler {};
interface EventTarget {};
interface Event {};
var idl_array = new IdlArray();
Navigator: ["throw new Error ('No object defined for the Navigator interface')"],
ServiceWorkerContainer: ["throw new Error ('No object defined for the ServiceWorkerContainer interface')"],
RegistrationOptionList: ["throw new Error ('No object defined for the RegistrationOptionList dictionary')"],
ReloadPageEvent: ["throw new Error ('No object defined for the ReloadPageEvent interface')"]