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 66520 3e8ec70c70ac97473fdcac1ca47f0696655c8f9a
parent 66519 a747b691f40e68121e59f7764d5a68d06ef9b40b
child 66521 658d5bef890da575960d602e183604a9ef63537d
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs591701
Bug 591701 - When loading about:home a second time, remote tabs button stays disabled [r=mfinkle]
mobile/chrome/content/aboutHome.xhtml
--- a/mobile/chrome/content/aboutHome.xhtml
+++ b/mobile/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();