tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PushSubscription.webidl (1586B)


      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 * https://w3c.github.io/push-api/
      8 */
      9 
     10 interface Principal;
     11 
     12 enum PushEncryptionKeyName
     13 {
     14  "p256dh",
     15  "auth"
     16 };
     17 
     18 dictionary PushSubscriptionKeys
     19 {
     20  ByteString p256dh;
     21  ByteString auth;
     22 };
     23 
     24 dictionary PushSubscriptionJSON
     25 {
     26  USVString endpoint;
     27  // FIXME: bug 1493860: should this "= {}" be here?  For that matter, this
     28  // PushSubscriptionKeys thing is not even in the spec; "keys" is a record
     29  // there.
     30  PushSubscriptionKeys keys = {};
     31  EpochTimeStamp? expirationTime;
     32 };
     33 
     34 dictionary PushSubscriptionInit
     35 {
     36  required USVString endpoint;
     37  required USVString scope;
     38  ArrayBuffer? p256dhKey = null;
     39  ArrayBuffer? authSecret = null;
     40  BufferSource? appServerKey = null;
     41  EpochTimeStamp? expirationTime = null;
     42 };
     43 
     44 [Exposed=(Window,Worker), Func="ServiceWorkersEnabled"]
     45 interface PushSubscription
     46 {
     47  [Throws, ChromeOnly]
     48  constructor(PushSubscriptionInit initDict);
     49 
     50  readonly attribute USVString endpoint;
     51  readonly attribute PushSubscriptionOptions options;
     52  readonly attribute EpochTimeStamp? expirationTime;
     53  [Throws]
     54  ArrayBuffer? getKey(PushEncryptionKeyName name);
     55  [NewObject, UseCounter]
     56  Promise<boolean> unsubscribe();
     57 
     58  // Implements the custom serializer specified in Push API, section 9.
     59  [Throws]
     60  PushSubscriptionJSON toJSON();
     61 };