Bug 814269 - social API keys should be disabled when command not available. r=jaws

This commit is contained in:
Mark Hammond 2012-11-27 17:59:51 +11:00
parent dfc6f73415
commit f0a1041df3
2 changed files with 5 additions and 1 deletions

View File

@ -112,7 +112,7 @@
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>
<command id="Browser:ToggleAddonBar" oncommand="toggleAddonBar();"/>
<command id="Social:SharePage" oncommand="SocialShareButton.sharePage();"/>
<command id="Social:SharePage" oncommand="SocialShareButton.sharePage();" disabled="true"/>
<command id="Social:UnsharePage" oncommand="SocialShareButton.unsharePage();"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();"/>
<command id="Social:ToggleNotifications" oncommand="Social.toggleNotifications();"/>

View File

@ -513,6 +513,10 @@ let SocialShareButton = {
shareButton.hidden = !Social.uiVisible || Social.provider.recommendInfo == null ||
!SocialUI.haveLoggedInUser() ||
!this.canSharePage(gBrowser.currentURI);
// also update the relevent command's disabled state so the keyboard
// shortcut only works when available.
let cmd = document.getElementById("Social:SharePage");
cmd.setAttribute("disabled", shareButton.hidden ? "true" : "false");
},
onClick: function SSB_onClick(aEvent) {