tor-browser

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

push-subscription.js (1237B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const { Actor } = require("resource://devtools/shared/protocol.js");
      8 const {
      9  pushSubscriptionSpec,
     10 } = require("resource://devtools/shared/specs/worker/push-subscription.js");
     11 
     12 class PushSubscriptionActor extends Actor {
     13  constructor(conn, subscription) {
     14    super(conn, pushSubscriptionSpec);
     15    this._subscription = subscription;
     16  }
     17 
     18  form() {
     19    const subscription = this._subscription;
     20 
     21    // Note: subscription.pushCount & subscription.lastPush are no longer
     22    // returned here because the corresponding getters throw on GeckoView.
     23    // Since they were not used in DevTools they were removed from the
     24    // actor in Bug 1637687. If they are reintroduced, make sure to provide
     25    // meaningful fallback values when debugging a GeckoView runtime.
     26    return {
     27      actor: this.actorID,
     28      endpoint: subscription.endpoint,
     29      quota: subscription.quota,
     30    };
     31  }
     32 
     33  destroy() {
     34    this._subscription = null;
     35    super.destroy();
     36  }
     37 }
     38 exports.PushSubscriptionActor = PushSubscriptionActor;