Bug 1032932 - Fix talos regression with share button. r=Gijs, a=lmandel
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 03 Jul 2014 12:11:28 -0700
changeset 207897 f4397dde382d6035cf0113e7ae55518de9008bd5
parent 207896 72514ae1ef74fbecfe0390681ad0efb4c405ef7b
child 207898 0e6ed467cb4dc988288e1b39bc7b4a866e004214
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, lmandel
bugs1032932
milestone32.0a2
Bug 1032932 - Fix talos regression with share button. r=Gijs, a=lmandel
browser/base/content/browser-social.js
browser/base/content/browser.xul
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -547,24 +547,25 @@ SocialShare = {
       return false;
 
     if (!aURI || !(aURI.schemeIs('http') || aURI.schemeIs('https')))
       return false;
     return true;
   },
 
   update: function() {
-    let shareButton = this.shareButton;
-    if (!shareButton)
+    let widget = CustomizableUI.getWidget("social-share-button");
+    if (!widget)
       return;
-    // if we got here, the button is in the window somewhere, update it's hidden
-    // state based on available providers.
-    shareButton.hidden = !SocialUI.enabled ||
-                         [p for (p of Social.providers) if (p.shareURL)].length == 0;
-    let disabled = shareButton.hidden || !this.canSharePage(gBrowser.currentURI);
+    let shareButton = widget.forWindow(window).node;
+    // hidden state is based on available share providers and location of
+    // button. It's always visible and disabled in the customization palette.
+    shareButton.hidden = !SocialUI.enabled || (widget.areaType &&
+                         [p for (p of Social.providers) if (p.shareURL)].length == 0);
+    let disabled = !widget.areaType || shareButton.hidden || !this.canSharePage(gBrowser.currentURI);
 
     // 1. update the relevent command's disabled state so the keyboard
     // shortcut only works when available.
     // 2. If the button has been relocated to a place that is not visible by
     // default (e.g. menu panel) then the disabled attribute will not update
     // correctly based on the command, so we update the attribute directly as.
     let cmd = document.getElementById("Social:SharePage");
     if (disabled) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -899,16 +899,17 @@
 
 
         <toolbarbutton id="social-share-button"
                        class="toolbarbutton-1 chromeclass-toolbar-additional"
                        label="&sharePageCmd.label;"
                        tooltiptext="&sharePageCmd.label;"
                        cui-areatype="toolbar"
                        removable="true"
+                       hidden="true"
                        command="Social:SharePage"/>
       </hbox>
 
       <toolbarbutton id="nav-bar-overflow-button"
                      class="toolbarbutton-1 chromeclass-toolbar-additional overflow-button"
                      cui-areatype="toolbar"
                      skipintoolbarset="true"
                      tooltiptext="&navbarOverflow.label;"/>