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 // ServiceWorkersEnabled internalizes the SecureContext check because we have a
12 // devtools affordance that allows this to pass on http as well as a test pref.
13 [Func="ServiceWorkersEnabled",
14 Exposed=(Window,Worker)]
15 interface ServiceWorkerContainer : EventTarget {
16 readonly attribute ServiceWorker? controller;
19 readonly attribute Promise<ServiceWorkerRegistration> ready;
21 [NewObject, NeedsCallerType, Throws]
22 Promise<ServiceWorkerRegistration> register((TrustedScriptURL or USVString) scriptURL,
23 optional RegistrationOptions options = {});
26 Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = "");
29 Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
31 undefined startMessages();
33 attribute EventHandler oncontrollerchange;
34 attribute EventHandler onmessage;
35 attribute EventHandler onmessageerror;
38 dictionary RegistrationOptions {
40 ServiceWorkerUpdateViaCache updateViaCache = "imports";