1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/ServiceWorker/#serviceworkercontainer
11 [Func="ServiceWorkersEnabled",
13 interface ServiceWorkerContainer : EventTarget {
15 // https://github.com/slightlyoff/ServiceWorker/issues/198
16 // and discussion at https://etherpad.mozilla.org/serviceworker07apr
17 readonly attribute ServiceWorker? controller;
20 readonly attribute Promise<ServiceWorkerRegistration> ready;
22 [NewObject, NeedsCallerType]
23 Promise<ServiceWorkerRegistration> register(USVString scriptURL,
24 optional RegistrationOptions options = {});
27 Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = "");
30 Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
32 undefined startMessages();
34 attribute EventHandler oncontrollerchange;
35 attribute EventHandler onmessage;
36 attribute EventHandler onmessageerror;
40 partial interface ServiceWorkerContainer {
41 [Throws,Pref="dom.serviceWorkers.testing.enabled"]
42 DOMString getScopeForUrl(DOMString url);
45 dictionary RegistrationOptions {
47 ServiceWorkerUpdateViaCache updateViaCache = "imports";