Bug 1270832 - Activate standard c++ library hardening r=glandium
[gecko.git] / dom / webidl / ServiceWorkerRegistration.webidl
blobc1f2ee79520c041041651596fbf9a1ae8747eeb2
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  * https://w3c.github.io/push-api/
9  * https://notifications.spec.whatwg.org/
10  * https://wicg.github.io/cookie-store/#idl-index
11  */
13 [Func="ServiceWorkersEnabled",
14  Exposed=(Window,Worker)]
15 interface ServiceWorkerRegistration : EventTarget {
16   readonly attribute ServiceWorker? installing;
17   readonly attribute ServiceWorker? waiting;
18   readonly attribute ServiceWorker? active;
20   [Pref="dom.serviceWorkers.navigationPreload.enabled", SameObject]
21   readonly attribute NavigationPreloadManager navigationPreload;
23   readonly attribute USVString scope;
24   [Throws]
25   readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
27   [Throws, NewObject]
28   Promise<undefined> update();
30   [Throws, NewObject]
31   Promise<boolean> unregister();
33   // event
34   attribute EventHandler onupdatefound;
37 enum ServiceWorkerUpdateViaCache {
38   "imports",
39   "all",
40   "none"
43 // https://w3c.github.io/push-api/
44 partial interface ServiceWorkerRegistration {
45   [Throws, Exposed=(Window,Worker), Pref="dom.push.enabled"]
46   readonly attribute PushManager pushManager;
49 // https://notifications.spec.whatwg.org/
50 partial interface ServiceWorkerRegistration {
51   [NewObject, Func="mozilla::dom::Notification::PrefEnabled"]
52   Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {});
53   [NewObject, Func="mozilla::dom::Notification::PrefEnabled"]
54   Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {});
57 /* Bug 1475599 - We decide to do not implement the entire cookie-store spec.
58  * Instead, we implement only the subset that is compatible with document.cookie
59 [Exposed=(ServiceWorker,Window)]
60 partial interface ServiceWorkerRegistration {
61   [SameObject] readonly attribute CookieStoreManager cookies;