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 * https://w3c.github.io/push-api/
9 * https://notifications.spec.whatwg.org/
12 [Func="ServiceWorkerVisible",
13 Exposed=(Window,Worker)]
14 interface ServiceWorkerRegistration : EventTarget {
15 readonly attribute ServiceWorker? installing;
16 readonly attribute ServiceWorker? waiting;
17 readonly attribute ServiceWorker? active;
19 [Pref="dom.serviceWorkers.navigationPreload.enabled", SameObject]
20 readonly attribute NavigationPreloadManager navigationPreload;
22 readonly attribute USVString scope;
24 readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
27 Promise<undefined> update();
30 Promise<boolean> unregister();
33 attribute EventHandler onupdatefound;
36 enum ServiceWorkerUpdateViaCache {
42 // https://w3c.github.io/push-api/
43 partial interface ServiceWorkerRegistration {
44 [Throws, Exposed=(Window,Worker), Pref="dom.push.enabled"]
45 readonly attribute PushManager pushManager;
48 // https://notifications.spec.whatwg.org/
49 partial interface ServiceWorkerRegistration {
50 [NewObject, Func="mozilla::dom::Notification::PrefEnabled"]
51 Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {});
52 [NewObject, Func="mozilla::dom::Notification::PrefEnabled"]
53 Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {});