Bug 1014254 - Fix null shareButton breaking various ui bits. r=gijs, a=lmandel
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 27 Jun 2014 08:46:27 -0700
changeset 207530 cc0ab48cb26439dc3e433d05a525535eab8651b9
parent 207529 cdc3b72c1e38072bbf3eec03f62ed0c960de84ab
child 207531 4213b6e90e570d1367b1469a0b6e2f343cefa804
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
bugs1014254
milestone32.0a2
Bug 1014254 - Fix null shareButton breaking various ui bits. 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
@@ -548,16 +548,20 @@ SocialShare = {
 
     if (!aURI || !(aURI.schemeIs('http') || aURI.schemeIs('https')))
       return false;
     return true;
   },
 
   update: function() {
     let shareButton = this.shareButton;
+    if (!shareButton)
+      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);
 
     // 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
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -895,17 +895,16 @@
                        key="goHome"
                        onclick="BrowserGoHome(event);"
                        cui-areatype="toolbar"
                        aboutHomeOverrideTooltip="&abouthome.pageTitle;"/>
 
 
         <toolbarbutton id="social-share-button"
                        class="toolbarbutton-1 chromeclass-toolbar-additional"
-                       hidden="true"
                        label="&sharePageCmd.label;"
                        tooltiptext="&sharePageCmd.label;"
                        cui-areatype="toolbar"
                        removable="true"
                        command="Social:SharePage"/>
       </hbox>
 
       <toolbarbutton id="nav-bar-overflow-button"