changeset 285:f944e6726d4c

suppress exceptions when SubscriptionListener gets called after Subscriber has disappeared
author Myk Melez <myk@mozilla.org>
date Tue, 02 Sep 2008 03:38:37 -0700
parents e9a79cea3deb
children 727bfe9d5fb7
files content/subscribe.js
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/content/subscribe.js	Tue Sep 02 03:38:06 2008 -0700
+++ b/content/subscribe.js	Tue Sep 02 03:38:37 2008 -0700
@@ -56,6 +56,15 @@
 window.addEventListener("load", function() { Subscriber.init() }, false);
 
 function SubscriptionListener(subject, topic, data) {
+  // FIXME: figure out why the SubscriptionListener hangs around and gets called
+  // sometimes after the page has been unloaded and Subscriber is not defined.
+  if (typeof Subscriber == "undefined") {
+    Log4Moz.Service.getLogger("Snowl.SubscriptionListener").warn(
+      "called without Subscriber; subject: " + subject + "; topic: " + topic +
+      "; data: " + data);
+    return;
+  }
+
   let source = Subscriber.feed;
 
   // Don't track the status of subscriptions happening in other windows/tabs.