Bug 595725 - Sync UI: popup is null. r=philikon a=blocking-beta9
authorPaul O'Shannessy <paul@oshannessy.com>
Wed, 15 Dec 2010 14:48:53 -0800
changeset 59283 e39c673699fa82cc2c57f3b25d00376940349547
parent 59282 0c04087b095d3fe0a747c30885774de12e94b728
child 59284 ec119059ab455f738b9fd09f90c249ceedc48c15
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersphilikon, blocking-beta9
bugs595725
milestone2.0b9pre
Bug 595725 - Sync UI: popup is null. r=philikon a=blocking-beta9
browser/base/content/browser-syncui.js
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -73,20 +73,22 @@ let gSyncUI = {
     let self = this;
     obs.forEach(function(topic) {
       Services.obs.addObserver(self, topic, true);
     });
 
     // Find the alltabs-popup, only if there is a gBrowser
     if (gBrowser) {
       let popup = document.getElementById("alltabs-popup");
-      let self = this;
-      popup.addEventListener("popupshowing", function() {
-        self.alltabsPopupShowing();
-      }, true);
+      if (popup) {
+        let self = this;
+        popup.addEventListener("popupshowing", function() {
+          self.alltabsPopupShowing();
+        }, true);
+      }
 
       if (Weave.Notifications.notifications.length)
         this.initNotifications();
     }
     this.updateUI();
   },
   
   initNotifications: function SUI_initNotifications() {
@@ -143,16 +145,19 @@ let gSyncUI = {
   alltabsPopupShowing: function(event) {
     // Should we show the menu item?
     if (!Weave.Service.isLoggedIn || !Weave.Engines.get("tabs").enabled)
       return;
 
     let label = this._stringBundle.GetStringFromName("tabs.fromOtherComputers.label");
 
     let popup = document.getElementById("alltabs-popup");
+    if (!popup)
+      return;
+    
     let menuitem = document.createElement("menuitem");
     menuitem.setAttribute("id", "sync-tabs-menuitem");
     menuitem.setAttribute("label", label);
     menuitem.setAttribute("class", "alltabs-item");
     menuitem.setAttribute("oncommand", "BrowserOpenSyncTabs();");
 
     let sep = document.createElement("menuseparator");
     sep.setAttribute("id", "sync-tabs-sep");