Bug 436758 - Show tooltip and URL in status bar when hovering over a link inside "Recently Closed Tabs/Windows", r=mak77
authorGabriele Best <gabri.best@gmail.com>
Fri, 04 Dec 2009 01:01:00 -0800
changeset 35691 215ca7a9e2ba566194dd8194f41e8b14defd95a9
parent 35690 e2f9cde1e66d427834e800fcf4a66d951c96ea4e
child 35692 1484f0779ccd57df9f00aba55a9331959ec6a7fc
push id10682
push userphilringnalda@gmail.com
push dateMon, 14 Dec 2009 02:11:07 +0000
treeherdermozilla-central@bc0849430750 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak77
bugs436758
milestone1.9.3a1pre
Bug 436758 - Show tooltip and URL in status bar when hovering over a link inside "Recently Closed Tabs/Windows", r=mak77
browser/base/content/browser-menubar.inc
browser/base/content/browser-places.js
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -489,23 +489,23 @@
                           key="showAllHistoryKb"
 #endif
                           command="Browser:ShowAllHistory"/>
                 <menuseparator id="startHistorySeparator"/>
                 <menuseparator id="endHistorySeparator" builder="end"/>
                 <menu id="historyUndoMenu"
                       label="&historyUndoMenu.label;"
                       disabled="true">
-                  <menupopup id="historyUndoPopup"
+                  <menupopup id="historyUndoPopup" placespopup="true"
                              onpopupshowing="HistoryMenu.populateUndoSubmenu();"/>
                 </menu>
                 <menu id="historyUndoWindowMenu"
                       label="&historyUndoWindowMenu.label;"
                       disabled="true">
-                  <menupopup id="historyUndoWindowPopup"
+                  <menupopup id="historyUndoWindowPopup" placespopup="true"
                              onpopupshowing="HistoryMenu.populateUndoWindowSubmenu();"/>
                 </menu>
               </menupopup>
             </menu>
 
   <menu id="bookmarksMenu"
         label="&bookmarksMenu.label;"
         accesskey="&bookmarksMenu.accesskey;"
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -632,16 +632,24 @@ var HistoryMenu = {
         // don't initiate a connection just to fetch a favicon (see bug 467828)
         if (/^https?:/.test(iconURL))
           iconURL = "moz-anno:favicon:" + iconURL;
         m.setAttribute("image", iconURL);
       }
       m.setAttribute("class", "menuitem-iconic bookmark-item");
       m.setAttribute("value", i);
       m.setAttribute("oncommand", "undoCloseTab(" + i + ");");
+
+      // Set the targetURI attribute so it will be shown in tooltip and statusbar.
+      // SessionStore uses one-based indexes, so we need to normalize them.
+      let tabData = undoItems[i].state;
+      let activeIndex = (tabData.index || tabData.entries.length) - 1;
+      if (activeIndex >= 0 && tabData.entries[activeIndex])
+        m.setAttribute("targetURI", tabData.entries[activeIndex].url);
+
       m.addEventListener("click", this._undoCloseMiddleClick, false);
       if (i == 0)
         m.setAttribute("key", "key_undoCloseTab");
       undoPopup.appendChild(m);
     }
 
     // "Restore All Tabs"
     var strings = gNavigatorBundle;
@@ -705,16 +713,23 @@ var HistoryMenu = {
         let iconURL = selectedTab.attributes.image;
         // don't initiate a connection just to fetch a favicon (see bug 467828)
         if (/^https?:/.test(iconURL))
           iconURL = "moz-anno:favicon:" + iconURL;
         m.setAttribute("image", iconURL);
       }
       m.setAttribute("class", "menuitem-iconic bookmark-item");
       m.setAttribute("oncommand", "undoCloseWindow(" + i + ");");
+
+      // Set the targetURI attribute so it will be shown in tooltip and statusbar.
+      // SessionStore uses one-based indexes, so we need to normalize them.
+      let activeIndex = (selectedTab.index || selectedTab.entries.length) - 1;
+      if (activeIndex >= 0 && selectedTab.entries[activeIndex])
+        m.setAttribute("targetURI", selectedTab.entries[activeIndex].url);
+
       if (i == 0)
         m.setAttribute("key", "key_undoCloseWindow");
       undoPopup.appendChild(m);
     }
 
     // "Open All in Windows"
     undoPopup.appendChild(document.createElement("menuseparator"));
     let m = undoPopup.appendChild(document.createElement("menuitem"));