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 * 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
12 * You are granted a license to use, reproduce and create derivative works of
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;
24 Promise<undefined> skipWaiting();
26 attribute EventHandler oninstall;
27 attribute EventHandler onactivate;
29 attribute EventHandler onfetch;
31 // The event.source of these MessageEvents are instances of Client
32 attribute EventHandler onmessage;
33 attribute EventHandler onmessageerror;
36 // These are from w3c.github.io/push-api/
37 partial interface ServiceWorkerGlobalScope {
38 attribute EventHandler onpush;
39 attribute EventHandler onpushsubscriptionchange;
42 // https://notifications.spec.whatwg.org/
43 partial interface ServiceWorkerGlobalScope {
44 attribute EventHandler onnotificationclick;
45 attribute EventHandler onnotificationclose;
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;
52 // https://wicg.github.io/cookie-store/#ServiceWorkerGlobalScope
53 partial interface ServiceWorkerGlobalScope {
54 [SameObject, Pref="dom.cookieStore.enabled"] readonly attribute CookieStore cookieStore;
56 /* Bug 1475599 - We decide to do not implement the entire cookie-store spec.
57 * Instead, we implement only the subset that is compatible with document.cookie
58 attribute EventHandler oncookiechange;