Bug 467828 - use cached favicons for the Recently Closed Tabs menu. r=gavin
authorSimon Bünzli <zeniko@gmail.com>
Sun, 07 Dec 2008 14:06:45 +0100
changeset 22457 c6befbfb54edfb3bb8883088341fffe7ce594119
parent 22456 aa5c4cc01baebcf759cbf24a3a0829d04cdbca1b
child 22458 a54efd040b2563dd254faea25584b14beb701746
push idunknown
push userunknown
push dateunknown
reviewersgavin
bugs467828
milestone1.9.2a1pre
Bug 467828 - use cached favicons for the Recently Closed Tabs menu. r=gavin
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6199,18 +6199,23 @@ HistoryMenu.populateUndoSubmenu = functi
   // enable menu
   undoPopup.parentNode.removeAttribute("disabled");
 
   // populate menu
   var undoItems = eval("(" + ss.getClosedTabData(window) + ")");
   for (var i = 0; i < undoItems.length; i++) {
     var m = document.createElement("menuitem");
     m.setAttribute("label", undoItems[i].title);
-    if (undoItems[i].image)
-      m.setAttribute("image", undoItems[i].image);
+    if (undoItems[i].image) {
+      let iconURL = undoItems[i].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("value", i);
     m.setAttribute("oncommand", "undoCloseTab(" + i + ");");
     m.addEventListener("click", undoCloseMiddleClick, false);
     if (i == 0)
       m.setAttribute("key", "key_undoCloseTab");
     undoPopup.appendChild(m);
   }