Bug 88541 - Show URI in status bar onmouseover of Back/Forward menu items. r=dao, r=mconnor, ui=faaborg
authorEdward Lee <edward.lee@engineering.uiuc.edu>
Wed, 31 Dec 2008 11:52:40 -0800
changeset 27626 5267ab4402c90a0824148644d5a4b0fde38d70de
parent 27625 ae0bb6ca4aa24f1a9d8541770dacd949bcec48fa
child 27627 96691981f65f5b0c3c2eb7792d4d602e3fb1dc3e
push id6661
push useredward.lee@engineering.uiuc.edu
push dateWed, 22 Apr 2009 16:30:54 +0000
treeherdermozilla-central@5267ab4402c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, mconnor
bugs88541
milestone1.9.2a1pre
Bug 88541 - Show URI in status bar onmouseover of Back/Forward menu items. r=dao, r=mconnor, ui=faaborg
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3090,16 +3090,31 @@ const BrowserSearch = {
     var where = newWindowPref == 3 ? "tab" : "window";
     var regionBundle = document.getElementById("bundle_browser_region");
     var searchEnginesURL = formatURL("browser.search.searchEnginesURL", true);
     openUILinkIn(searchEnginesURL, where);
   }
 }
 
 function FillHistoryMenu(aParent) {
+  // Lazily add the hover listeners on first showing and never remove them
+  if (!aParent.hasStatusListener) {
+    // Show history item's uri in the status bar when hovering, and clear on exit
+    aParent.addEventListener("DOMMenuItemActive", function(aEvent) {
+      // Only the current page should have the checked attribute, so skip it
+      if (!aEvent.target.hasAttribute("checked"))
+        XULBrowserWindow.setOverLink(aEvent.target.getAttribute("uri"));
+    }, false);
+    aParent.addEventListener("DOMMenuItemInactive", function() {
+      XULBrowserWindow.setOverLink("");
+    }, false);
+
+    aParent.hasStatusListener = true;
+  }
+
   // Remove old entries if any
   var children = aParent.childNodes;
   for (var i = children.length - 1; i >= 0; --i) {
     if (children[i].hasAttribute("index"))
       aParent.removeChild(children[i]);
   }
 
   var webNav = getWebNavigation();
@@ -3121,18 +3136,20 @@ function FillHistoryMenu(aParent) {
 
   var tooltipBack = bundle_browser.getString("tabHistory.goBack");
   var tooltipCurrent = bundle_browser.getString("tabHistory.current");
   var tooltipForward = bundle_browser.getString("tabHistory.goForward");
 
   for (var j = end - 1; j >= start; j--) {
     let item = document.createElement("menuitem");
     let entry = sessionHistory.getEntryAtIndex(j, false);
-
-    item.setAttribute("label", entry.title || entry.URI.spec);
+    let uri = entry.URI.spec;
+
+    item.setAttribute("uri", uri);
+    item.setAttribute("label", entry.title || uri);
     item.setAttribute("index", j);
 
     if (j != index) {
       try {
         let iconURL = Cc["@mozilla.org/browser/favicon-service;1"]
                          .getService(Ci.nsIFaviconService)
                          .getFaviconForPage(entry.URI).spec;
         item.style.listStyleImage = "url(" + iconURL + ")";