Make sure that a command is enabled in doCommand()
authorFabrice Desré <fabrice@mozilla.com>
Thu, 23 Sep 2010 05:00:00 -0400
changeset 66748 45cea9ece01c533bbc2c5abcb47b18bf7b9cfd40
parent 66747 8f43e5b7b33014fd69b329ab318f29a840c39141
child 66749 3dff38d74bb792965c74ea09a8dae0e52d1879da
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Make sure that a command is enabled in doCommand() Make sure that a command is enabled in doCommand()
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -901,20 +901,25 @@ var BrowserUI = {
       default:
         isSupported = false;
         break;
     }
     return isSupported;
   },
 
   isCommandEnabled : function(cmd) {
+    let elem = document.getElementById(cmd);
+    if (elem && (elem.getAttribute("disabled") == "true"))
+      return false;
     return true;
   },
 
   doCommand : function(cmd) {
+    if (!this.isCommandEnabled(cmd))
+      return;
     let browser = getBrowser();
     switch (cmd) {
       case "cmd_back":
         browser.goBack();
         break;
       case "cmd_forward":
         browser.goForward();
         break;