Bug 1614879 [wpt PR 21750] - Set request mode for beacon request with non-cors-safeli...
[gecko.git] / dom / webidl / PushManager.webidl
blob72190a838ddf8069da061abc008b7bdc1ca75544
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 * https://w3c.github.io/push-api/
8 */
10 dictionary PushSubscriptionOptionsInit {
11   // boolean userVisibleOnly = false;
12   (BufferSource or DOMString)? applicationServerKey = null;
15 // The main thread JS implementation. Please see comments in
16 // dom/push/PushManager.h for the split between PushManagerImpl and PushManager.
17 [JSImplementation="@mozilla.org/push/PushManager;1",
18  ChromeOnly,
19  Exposed=Window]
20 interface PushManagerImpl {
21   [Throws]
22   constructor(DOMString scope);
24   Promise<PushSubscription>    subscribe(optional PushSubscriptionOptionsInit options = {});
25   Promise<PushSubscription?>   getSubscription();
26   Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
29 [Exposed=(Window,Worker), Pref="dom.push.enabled"]
30 interface PushManager {
31   [Throws, ChromeOnly]
32   constructor(DOMString scope);
34   [Throws, UseCounter]
35   Promise<PushSubscription>    subscribe(optional PushSubscriptionOptionsInit options = {});
36   [Throws]
37   Promise<PushSubscription?>   getSubscription();
38   [Throws]
39   Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
42 enum PushPermissionState
44     "granted",
45     "denied",
46     "prompt"