Bug 591701 - When loading about:home a second time, remote tabs button stays disabled [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 31 Aug 2010 23:49:37 +0200
changeset 1876 af07a287e16d1e4ba0ccbcda0b041afb9da62665
parent 1875 220702dba766a092228b8642b815d33dc69dc6cd
child 1877 bb790bfcba553d3b3578df57860b4d5da3f1b3d2
push id1660
push uservnicolas@mozilla.com
push dateTue, 31 Aug 2010 21:51:24 +0000
reviewersmfinkle
bugs591701
Bug 591701 - When loading about:home a second time, remote tabs button stays disabled [r=mfinkle]
chrome/content/aboutHome.xhtml
--- a/chrome/content/aboutHome.xhtml
+++ b/chrome/content/aboutHome.xhtml
@@ -202,17 +202,17 @@
         let titlePart = document.createElement("div");
         titlePart.textContent = title;
         titlePart.className = "title";
         inner.appendChild(titlePart);
 
         outer.appendChild(inner);
         list.appendChild(outer);
       }
-      
+
       if (allPageURLs.length > 0) {
         document.getElementById("loadingTabs").style.display = "none";
 
         if (allPageURLs.length > 1) {
           let outer = document.createElement("div");
           outer.className = "openall";
           outer.textContent = document.getElementById("text-openalltabs").textContent;
           outer.setAttribute("role", "button");
@@ -229,33 +229,38 @@
       }
     }
 
     function initWeave() {
       let chromeWin = getChromeWin();
       if ("WeaveGlue" in chromeWin) {
         chromeWin.Services.obs.addObserver(updateWeaveButton, "weave:service:login:finish", false);
         chromeWin.Services.obs.addObserver(updateWeaveButton, "weave:service:logout:finish", false);
+
+        updateWeaveButton();
       }
       else {
         document.getElementById("remoteTabs").style.display = "none";
       }
     }
 
     function uninitWeave() {
       let chromeWin = getChromeWin();
       if ("WeaveGlue" in chromeWin) {
         chromeWin.Services.obs.removeObserver(updateWeaveButton, "weave:service:login:finish");
         chromeWin.Services.obs.removeObserver(updateWeaveButton, "weave:service:logout:finish");
       }
     }
 
     function updateWeaveButton() {
-      let isDisabled = !getChromeWin().Weave.Service.isLoggedIn;
-      document.getElementById("remoteTabs").setAttribute("disabled", isDisabled);
+      let chromeWin = getChromeWin();
+      if (chromeWin.Weave) {
+        let isDisabled = !chromeWin.Weave.Service.isLoggedIn;
+        document.getElementById("remoteTabs").setAttribute("disabled", isDisabled);
+      }
     }
 
     function openRemoteTabs() {
       getChromeWin().CommandUpdater.doCommand("cmd_remoteTabs");
     }
 
     function goToAddons(aSearchString) {
       let chromeWin = getChromeWin();