Bug 804442 - update command Social:Toggle instead of social menu items directly. r=dao
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 23 Oct 2012 18:47:33 +1100
changeset 111121 5077791b4ea4395f4b9eb6345b603913b99c6b97
parent 111120 db2bf849fcb508f555edcab5744de8fbe25164b2
child 111122 ecc0cdaf35809b7fa0f61c991883898192599643
push id16881
push usermhammond@skippinet.com.au
push dateTue, 23 Oct 2012 07:47:51 +0000
treeherdermozilla-inbound@5077791b4ea4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs804442
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 804442 - update command Social:Toggle instead of social menu items directly. r=dao
browser/base/content/browser-social.js
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -98,31 +98,19 @@ let SocialUI = {
 
     SocialToolbar.init();
     SocialShareButton.init();
     SocialSidebar.init();
   },
 
   updateToggleCommand: function SocialUI_updateToggleCommand() {
     let toggleCommand = this.toggleCommand;
+    // We only need to update the command itself - all our menu items use it.
     toggleCommand.setAttribute("checked", Services.prefs.getBoolPref("social.enabled"));
-
-    // FIXME: bug 772808: menu items don't inherit the "hidden" state properly,
-    // need to update them manually.
-    // This should just be: toggleCommand.hidden = !Social.active;
-    for (let id of ["appmenu_socialToggle", "menu_socialToggle", "menu_socialAmbientMenu"]) {
-      let el = document.getElementById(id);
-      if (!el)
-        continue;
-
-      if (Social.active)
-        el.removeAttribute("hidden");
-      else
-        el.setAttribute("hidden", "true");
-    }
+    toggleCommand.setAttribute("hidden", Social.active ? "false" : "true");
   },
 
   // This handles "ActivateSocialFeature" events fired against content documents
   // in this window.
   _activationEventHandler: function SocialUI_activationHandler(e) {
     // Nothing to do if Social is already active, or we don't have a provider
     // to enable yet.
     if (Social.active || !Social.provider)
@@ -919,17 +907,17 @@ var SocialSidebar = {
     let evt = sbrowser.contentDocument.createEvent("CustomEvent");
     evt.initCustomEvent(aType, true, true, aDetail ? aDetail : {});
     sbrowser.contentDocument.documentElement.dispatchEvent(evt);
   },
 
   updateSidebar: function SocialSidebar_updateSidebar() {
     // Hide the toggle menu item if the sidebar cannot appear
     let command = document.getElementById("Social:ToggleSidebar");
-    command.hidden = !this.canShow;
+    command.setAttribute("hidden", this.canShow ? "false" : "true");
 
     // Hide the sidebar if it cannot appear, or has been toggled off.
     // Also set the command "checked" state accordingly.
     let hideSidebar = !this.canShow || !this.opened;
     let broadcaster = document.getElementById("socialSidebarBroadcaster");
     broadcaster.hidden = hideSidebar;
     command.setAttribute("checked", !hideSidebar);