Bug 663771 - HistoryMenu.toggleTabsFromOtherComputers doesn't account for other uses of the HistoryMenu class; r=mak77
authorGeoff Lankow <geoff@darktrojan.net>
Sat, 18 Jun 2011 20:59:03 +1200
changeset 71564 4c809dfcb658980c9c11419d68ba7bbea38fd553
parent 71563 2cc9093cdd2399744acab52c47350c5bd62e6690
child 71565 b1d2e03ba8097c8cce9ed16ce298f8c398de2306
push id209
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:42:16 +0000
treeherdermozilla-aurora@cc6e30cce8af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak77
bugs663771
milestone7.0a1
Bug 663771 - HistoryMenu.toggleTabsFromOtherComputers doesn't account for other uses of the HistoryMenu class; r=mak77
browser/base/content/browser-menubar.inc
browser/base/content/browser-places.js
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -381,16 +381,17 @@
                           label="&showAllHistoryCmd2.label;"
 #ifndef XP_MACOSX
                           key="showAllHistoryKb"
 #endif
                           command="Browser:ShowAllHistory"/>
                 <menuseparator id="showAllHistorySeparator"/>
 #ifdef MOZ_SERVICES_SYNC
                 <menuitem id="sync-tabs-menuitem"
+                          class="syncTabsMenuItem"
                           label="&syncTabsMenu.label;"
                           oncommand="BrowserOpenSyncTabs();"
                           disabled="true"/>
 #endif
                 <menuitem id="historyRestoreLastSession"
                           class="restoreLastSession"
                           label="&historyRestoreLastSession.label;"
                           oncommand="restoreLastSession();"
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -654,18 +654,21 @@ HistoryMenu.prototype = {
     m.setAttribute("label", gNavigatorBundle.getString("menuRestoreAllWindows.label"));
     m.setAttribute("oncommand",
       "for (var i = 0; i < " + undoItems.length + "; i++) undoCloseWindow();");
   },
 
   toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() {
     // This is a no-op if MOZ_SERVICES_SYNC isn't defined
 #ifdef MOZ_SERVICES_SYNC
-    // enable/disable the Tabs From Other Computers menu
-    let menuitem = document.getElementById("sync-tabs-menuitem");
+    // Enable/disable the Tabs From Other Computers menu. Some of the menus handled
+    // by HistoryMenu do not have this menuitem.
+    let menuitem = this._rootElt.getElementsByClassName("syncTabsMenuItem")[0];
+    if (!menuitem)
+      return;
 
     // If Sync isn't configured yet, then don't show the menuitem.
     if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED ||
         Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
       menuitem.setAttribute("hidden", true);
       return;
     }