Bug 1564094 - Follow-up: With history enabled, check that back/forward buttons are there. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Sun, 14 Jul 2019 00:09:48 +0200
changeset 36077 6d4d817756427f3c4cf7f476d2f91045928e8755
parent 36076 099ce2ae99a078da668f572217509fb2ab7f0e46
child 36078 ef4e72ba20242308037bb8f956b8548afef4c1f5
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersaceman, jorgk
bugs1564094
Bug 1564094 - Follow-up: With history enabled, check that back/forward buttons are there. r=aceman a=jorgk
common/src/viewSource.js
--- a/common/src/viewSource.js
+++ b/common/src/viewSource.js
@@ -567,25 +567,29 @@ ViewSourceChrome.prototype = {
 
   /**
    * Updates any applicable commands.
    */
   updateCommands() {
     let backCommand = document.getElementById("Browser:Back");
     let forwardCommand = document.getElementById("Browser:Forward");
 
-    if (this.webNav.canGoBack) {
-      backCommand.removeAttribute("disabled");
-    } else {
-      backCommand.setAttribute("disabled", "true");
+    if (backCommand) {
+      if (this.webNav.canGoBack) {
+        backCommand.removeAttribute("disabled");
+      } else {
+        backCommand.setAttribute("disabled", "true");
+      }
     }
-    if (this.webNav.canGoForward) {
-      forwardCommand.removeAttribute("disabled");
-    } else {
-      forwardCommand.setAttribute("disabled", "true");
+    if (forwardCommand) {
+      if (this.webNav.canGoForward) {
+        forwardCommand.removeAttribute("disabled");
+      } else {
+        forwardCommand.setAttribute("disabled", "true");
+      }
     }
   },
 
   /**
    * Reloads the browser, bypassing the network cache.
    */
   reload() {
     this.browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY |