Bug 1945643 - Update to mozilla-nimbus-schemas 2025.1.1 r=chumphreys
[gecko.git] / dom / webidl / ServiceWorkerContainer.webidl
blobd6f29f05fb2eb3dfb363e8c13e5585ebff320c28
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 // 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;
18   [Throws]
19   readonly attribute Promise<ServiceWorkerRegistration> ready;
21   [NewObject, NeedsCallerType, Throws]
22   Promise<ServiceWorkerRegistration> register((TrustedScriptURL or USVString) scriptURL,
23                                               optional RegistrationOptions options = {});
25   [NewObject]
26   Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = "");
28   [NewObject]
29   Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
31   undefined startMessages();
33   attribute EventHandler oncontrollerchange;
34   attribute EventHandler onmessage;
35   attribute EventHandler onmessageerror;
38 dictionary RegistrationOptions {
39   USVString scope;
40   ServiceWorkerUpdateViaCache updateViaCache = "imports";