XULBrowserWindow.onLocationChange / BF command debugging draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 20 May 2016 18:45:46 -0500
changeset 375857 aed014d97a9a9940be72d35b9dff908f3a07948e
parent 375856 6e29163512d2e56e9cbe016ee1c88504f86e2d9f
child 375858 c5a24d3db321a15731c1ff413cb4f56d7dd1adb0
push id20402
push userbmo:jryans@gmail.com
push dateMon, 06 Jun 2016 20:31:20 +0000
milestone49.0a1
XULBrowserWindow.onLocationChange / BF command debugging MozReview-Commit-ID: 3JyoniJbGTS
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -276,16 +276,17 @@ function* browserWindows() {
 * We can avoid adding multiple load event listeners and save some time by adding
 * one listener that calls all real handlers.
 */
 function pageShowEventHandlers(persisted) {
   XULBrowserWindow.asyncUpdateUI();
 }
 
 function UpdateBackForwardCommands(aWebNavigation) {
+  dump(`Update bf commands: ${aWebNavigation.canGoBack}, ${aWebNavigation.canGoForward}\n`);
   var backBroadcaster = document.getElementById("Browser:Back");
   var forwardBroadcaster = document.getElementById("Browser:Forward");
 
   // Avoid setting attributes on broadcasters if the value hasn't changed!
   // Remember, guys, setting attributes on elements is expensive!  They
   // get inherited into anonymous content, broadcast to other widgets, etc.!
   // Don't do it if the value hasn't changed! - dwh
 
@@ -4378,16 +4379,17 @@ var XULBrowserWindow = {
 
         this.stopCommand.setAttribute("disabled", "true");
         CombinedStopReload.switchToReload(aRequest instanceof Ci.nsIRequest);
       }
     }
   },
 
   onLocationChange: function (aWebProgress, aRequest, aLocationURI, aFlags) {
+    dump("XULBrowserWindow.onLocationChange\n");
     var location = aLocationURI ? aLocationURI.spec : "";
 
     // If displayed, hide the form validation popup.
     FormValidationHandler.hidePopup();
 
     let pageTooltip = document.getElementById("aHTMLTooltip");
     let tooltipNode = pageTooltip.triggerNode;
     if (tooltipNode) {
@@ -4419,16 +4421,17 @@ var XULBrowserWindow = {
     this.setOverLink("", null);
     this.hideOverLinkImmediately = false;
 
     // We should probably not do this if the value has changed since the user
     // searched
     // Update urlbar only if a new page was loaded on the primary content area
     // Do not update urlbar if there was a subframe navigation
 
+    dump(`top level: ${aWebProgress.isTopLevel}\n`);
     if (aWebProgress.isTopLevel) {
       if ((location == "about:blank" && checkEmptyPageOrigin()) ||
           location == "") {  // Second condition is for new tabs, otherwise
                              // reload function is enabled until tab is refreshed.
         this.reloadCommand.setAttribute("disabled", "true");
       } else {
         this.reloadCommand.removeAttribute("disabled");
       }