Bug 1252604 - Change logic in alarms observer to return immediately if the alarm has been cancelled, r?kmag
MozReview-Commit-ID: LahP6ESDTGd
--- a/toolkit/components/extensions/ext-alarms.js
+++ b/toolkit/components/extensions/ext-alarms.js
@@ -44,22 +44,23 @@ function Alarm(extension, name, alarmInf
Alarm.prototype = {
clear() {
this.timer.cancel();
alarmsMap.get(this.extension).delete(this.name);
this.canceled = true;
},
observe(subject, topic, data) {
+ if (this.canceled) {
+ return;
+ }
+
for (let callback of alarmCallbacksMap.get(this.extension)) {
callback(this);
}
- if (this.canceled) {
- return;
- }
if (!this.periodInMinutes) {
this.clear();
return;
}
let delay = this.periodInMinutes * 60 * 1000;
this.scheduledTime = Date.now() + delay;