Bug 1277928 - Don't wait to update the quota for privileged push subscriptions. r=wchen
authorKit Cambridge <kcambridge@mozilla.com>
Fri, 03 Jun 2016 11:45:46 -0700
changeset 300999 51bd83e16a49cf1c31114ba2f767295e5d50b0d2
parent 300998 f7e1ab1bd99c05c219fe75913f8f37ba39aec092
child 301000 eb00b57e9cd0e2d8de9b6036dce929083db8a932
push id30324
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 09:58:15 +0000
treeherdermozilla-central@f8ad071a6e14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswchen
bugs1277928
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277928 - Don't wait to update the quota for privileged push subscriptions. r=wchen MozReview-Commit-ID: CwPR7vnvqNp
dom/push/PushService.jsm
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -795,26 +795,28 @@ this.PushService = {
   receivedPushMessage(keyID, messageID, data, cryptoParams, updateFunc) {
     console.debug("receivedPushMessage()");
     Services.telemetry.getHistogramById("PUSH_API_NOTIFICATION_RECEIVED").add();
 
     return this._updateRecordAfterPush(keyID, updateFunc).then(record => {
       if (!record) {
         throw new Error("Ignoring update for key ID " + keyID);
       }
-      // Update quota after the delay, at which point
-      // we check for visible notifications.
-      let timeoutID = setTimeout(_ =>
-        {
-          this._updateQuota(keyID);
-          if (!this._updateQuotaTimeouts.delete(timeoutID)) {
-            console.debug("receivedPushMessage: quota update timeout missing?");
-          }
-        }, prefs.get("quotaUpdateDelay"));
-      this._updateQuotaTimeouts.add(timeoutID);
+      if (record.quotaApplies()) {
+        // Update quota after the delay, at which point
+        // we check for visible notifications.
+        let timeoutID = setTimeout(_ =>
+          {
+            this._updateQuota(keyID);
+            if (!this._updateQuotaTimeouts.delete(timeoutID)) {
+              console.debug("receivedPushMessage: quota update timeout missing?");
+            }
+          }, prefs.get("quotaUpdateDelay"));
+        this._updateQuotaTimeouts.add(timeoutID);
+      }
       return this._decryptAndNotifyApp(record, messageID, data, cryptoParams);
     }).catch(error => {
       console.error("receivedPushMessage: Error notifying app", error);
       return Ci.nsIPushErrorReporter.ACK_NOT_DELIVERED;
     });
   },
 
   /**