Bug 1277928 - Don't wait to update the quota for privileged push subscriptions. r=wchen

MozReview-Commit-ID: CwPR7vnvqNp

--HG--
extra : rebase_source : 9479af0cd51b8469fe2306a8f70643d4ae31a05b
extra : histedit_source : eceb7547fe1a90307ca26d550133a90daf6cf4ee
This commit is contained in:
Kit Cambridge 2016-06-03 11:45:46 -07:00
Родитель d8d829d3c8
Коммит a48c0ef397
1 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -800,16 +800,18 @@ this.PushService = {
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);