ServiceWorkerContainer.webidl (1518B)
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 */ 10 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; 17 18 [Throws] 19 readonly attribute Promise<ServiceWorkerRegistration> ready; 20 21 [NewObject, NeedsSubjectPrincipal=NonSystem, Throws] 22 Promise<ServiceWorkerRegistration> register((TrustedScriptURL or USVString) scriptURL, 23 optional RegistrationOptions options = {}); 24 25 [NewObject] 26 Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = ""); 27 28 [NewObject] 29 Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); 30 31 undefined startMessages(); 32 33 attribute EventHandler oncontrollerchange; 34 attribute EventHandler onmessage; 35 attribute EventHandler onmessageerror; 36 }; 37 38 dictionary RegistrationOptions { 39 USVString scope; 40 WorkerType type = "classic"; 41 ServiceWorkerUpdateViaCache updateViaCache = "imports"; 42 };