2015-04-11 06:19:28 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* https://w3c.github.io/push-api/
|
|
|
|
*/
|
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
interface Principal;
|
|
|
|
|
2015-09-11 17:51:32 +03:00
|
|
|
enum PushEncryptionKeyName
|
|
|
|
{
|
2015-12-08 23:26:42 +03:00
|
|
|
"p256dh",
|
|
|
|
"auth"
|
2015-09-11 17:51:32 +03:00
|
|
|
};
|
|
|
|
|
2015-12-15 03:28:19 +03:00
|
|
|
dictionary PushSubscriptionKeys
|
|
|
|
{
|
|
|
|
ByteString p256dh;
|
|
|
|
ByteString auth;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PushSubscriptionJSON
|
|
|
|
{
|
|
|
|
USVString endpoint;
|
|
|
|
PushSubscriptionKeys keys;
|
|
|
|
};
|
|
|
|
|
2016-03-22 23:38:03 +03:00
|
|
|
dictionary PushSubscriptionInit
|
|
|
|
{
|
|
|
|
required USVString endpoint;
|
|
|
|
required USVString scope;
|
|
|
|
ArrayBuffer? p256dhKey;
|
|
|
|
ArrayBuffer? authSecret;
|
|
|
|
BufferSource? appServerKey;
|
|
|
|
};
|
|
|
|
|
2018-01-08 16:05:05 +03:00
|
|
|
[Exposed=(Window,Worker), Func="mozilla::dom::DOMPrefs::PushEnabled",
|
2016-03-22 23:38:03 +03:00
|
|
|
ChromeConstructor(PushSubscriptionInit initDict)]
|
2015-04-11 06:19:28 +03:00
|
|
|
interface PushSubscription
|
|
|
|
{
|
2016-03-22 23:38:03 +03:00
|
|
|
readonly attribute USVString endpoint;
|
|
|
|
readonly attribute PushSubscriptionOptions options;
|
|
|
|
[Throws]
|
|
|
|
ArrayBuffer? getKey(PushEncryptionKeyName name);
|
|
|
|
[Throws, UseCounter]
|
|
|
|
Promise<boolean> unsubscribe();
|
2015-12-15 03:28:19 +03:00
|
|
|
|
2016-03-22 23:38:03 +03:00
|
|
|
// Implements the custom serializer specified in Push API, section 9.
|
|
|
|
[Throws]
|
|
|
|
PushSubscriptionJSON toJSON();
|
2015-04-23 03:30:10 +03:00
|
|
|
};
|