Created
April 18, 2016 18:45
-
-
Save rpl/285c068c7cb220d91c5ee54b2a9f8178 to your computer and use it in GitHub Desktop.
exception on ext-notifications.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/toolkit/components/extensions/ext-notifications.js b/toolkit/components/extensions/ext-notifications.js | |
--- a/toolkit/components/extensions/ext-notifications.js | |
+++ b/toolkit/components/extensions/ext-notifications.js | |
@@ -47,24 +47,31 @@ Notification.prototype = { | |
svc.closeAlert(this.id); | |
} catch (e) { | |
// This will fail if the OS doesn't support this function. | |
} | |
notificationsMap.get(this.extension).delete(this.id); | |
}, | |
observe(subject, topic, data) { | |
+ let notifications = notificationsMap.get(this.extension); | |
+ if (!notifications) { | |
+ // no notifications found for the addon, e.g. the addon has been | |
+ // already unloaded. | |
+ return; | |
+ } | |
+ | |
if (topic === "alertclickcallback") { | |
- notificationsMap.get(this.extension).emit("clicked", data); | |
+ notifications.emit("clicked", data); | |
} | |
if (topic === "alertfinished") { | |
- notificationsMap.get(this.extension).emit("closed", data); | |
+ notifications.emit("closed", data); | |
} | |
- notificationsMap.get(this.extension).delete(this.id); | |
+ notifications.delete(this.id); | |
}, | |
}; | |
/* eslint-disable mozilla/balanced-listeners */ | |
extensions.on("startup", (type, extension) => { | |
let map = new Map(); | |
EventEmitter.decorate(map); | |
notificationsMap.set(extension, map); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment