2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-04-11 06:19:28 +03:00
|
|
|
/* 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;
|
2019-07-03 10:52:35 +03:00
|
|
|
// FIXME: bug 1493860: should this "= {}" be here? For that matter, this
|
2018-09-26 01:09:30 +03:00
|
|
|
// PushSubscriptionKeys thing is not even in the spec; "keys" is a record
|
|
|
|
// there.
|
2019-07-03 10:52:35 +03:00
|
|
|
PushSubscriptionKeys keys = {};
|
2015-12-15 03:28:19 +03:00
|
|
|
};
|
|
|
|
|
2016-03-22 23:38:03 +03:00
|
|
|
dictionary PushSubscriptionInit
|
|
|
|
{
|
|
|
|
required USVString endpoint;
|
|
|
|
required USVString scope;
|
|
|
|
ArrayBuffer? p256dhKey;
|
|
|
|
ArrayBuffer? authSecret;
|
|
|
|
BufferSource? appServerKey;
|
|
|
|
};
|
|
|
|
|
2019-09-12 00:04:12 +03:00
|
|
|
[Exposed=(Window,Worker), Pref="dom.push.enabled"]
|
2015-04-11 06:19:28 +03:00
|
|
|
interface PushSubscription
|
|
|
|
{
|
2019-09-12 00:04:12 +03:00
|
|
|
[Throws, ChromeOnly]
|
|
|
|
constructor(PushSubscriptionInit initDict);
|
|
|
|
|
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
|
|
|
};
|