Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / ServiceWorkerContainer.webidl
blobcecc2e01ab669940c92d2e41999664f419829a85
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/.
5  *
6  * The origin of this IDL file is
7  * https://w3c.github.io/ServiceWorker/#serviceworkercontainer
8  *
9  */
11 [Func="ServiceWorkersEnabled",
12  Exposed=Window]
13 interface ServiceWorkerContainer : EventTarget {
14   // FIXME(nsm):
15   // https://github.com/slightlyoff/ServiceWorker/issues/198
16   // and discussion at https://etherpad.mozilla.org/serviceworker07apr
17   readonly attribute ServiceWorker? controller;
19   [Throws]
20   readonly attribute Promise<ServiceWorkerRegistration> ready;
22   [NewObject, NeedsCallerType]
23   Promise<ServiceWorkerRegistration> register(USVString scriptURL,
24                                               optional RegistrationOptions options = {});
26   [NewObject]
27   Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = "");
29   [NewObject]
30   Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
32   undefined startMessages();
34   attribute EventHandler oncontrollerchange;
35   attribute EventHandler onmessage;
36   attribute EventHandler onmessageerror;
39 // Testing only.
40 partial interface ServiceWorkerContainer {
41   [Throws,Pref="dom.serviceWorkers.testing.enabled"]
42   DOMString getScopeForUrl(DOMString url);
45 dictionary RegistrationOptions {
46   USVString scope;
47   ServiceWorkerUpdateViaCache updateViaCache = "imports";