ServiceWorkerGlobalScope.webidl (2104B)
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 * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html 8 * http://w3c.github.io/push-api/ 9 * https://notifications.spec.whatwg.org/ 10 * https://wicg.github.io/cookie-store/#ServiceWorkerGlobalScope 11 * 12 * You are granted a license to use, reproduce and create derivative works of 13 * this document. 14 */ 15 16 [Global=(Worker,ServiceWorker), 17 Exposed=ServiceWorker] 18 interface ServiceWorkerGlobalScope : WorkerGlobalScope { 19 [SameObject, BinaryName="GetClients"] 20 readonly attribute Clients clients; 21 [SameObject] readonly attribute ServiceWorkerRegistration registration; 22 23 [Throws, NewObject] 24 Promise<undefined> skipWaiting(); 25 26 attribute EventHandler oninstall; 27 attribute EventHandler onactivate; 28 29 attribute EventHandler onfetch; 30 31 // The event.source of these MessageEvents are instances of Client 32 attribute EventHandler onmessage; 33 attribute EventHandler onmessageerror; 34 }; 35 36 // These are from w3c.github.io/push-api/ 37 partial interface ServiceWorkerGlobalScope { 38 attribute EventHandler onpush; 39 attribute EventHandler onpushsubscriptionchange; 40 }; 41 42 // https://notifications.spec.whatwg.org/ 43 partial interface ServiceWorkerGlobalScope { 44 attribute EventHandler onnotificationclick; 45 attribute EventHandler onnotificationclose; 46 }; 47 48 // Mixin the WebExtensions API globals (the actual properties are only available to 49 // extension service workers, locked behind a Func="extensions::ExtensionAPIAllowed" annotation). 50 ServiceWorkerGlobalScope includes ExtensionGlobalsMixin; 51 52 // https://wicg.github.io/cookie-store/#ServiceWorkerGlobalScope 53 partial interface ServiceWorkerGlobalScope { 54 [SameObject, Pref="dom.cookieStore.enabled"] readonly attribute CookieStore cookieStore; 55 56 [Pref="dom.cookieStore.enabled"] 57 attribute EventHandler oncookiechange; 58 };