Bug 1163559 - Search engine icons are always displayed at low resolution. r=florian, a=lizzard
authorNihanth Subramanya <nhnt11@.gmail.com>
Wed, 27 May 2015 18:04:07 -0700
changeset 266184 8ecfee4a2185
parent 266183 c271d2f06862
child 266185 516ef88d8790
push id4779
push userryanvm@gmail.com
push date2015-06-04 14:18 +0000
treeherdermozilla-beta@516ef88d8790 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, lizzard
bugs1163559
milestone39.0
Bug 1163559 - Search engine icons are always displayed at low resolution. r=florian, a=lizzard
toolkit/components/places/PlacesUtils.jsm
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1590,17 +1590,21 @@ this.PlacesUtils = {
    *
    * @param aHeight
    *        The target image height
    *
    * @return The URL with the fragment at the end
    */
   getImageURLForResolution:
   function PU_getImageURLForResolution(aWindow, aURL, aWidth = 16, aHeight = 16) {
-    if (!aURL.endsWith('.ico') && !aURL.endsWith('.ICO')) {
+    // We only want to modify the URL when the file extension is ".ico" or
+    // it's a data URI with an icon media-type.
+    let uri = Services.io.newURI(aURL, null, null);
+    if ((!(uri instanceof Ci.nsIURL) || uri.fileExtension.toLowerCase() != "ico") &&
+        !/^data:image\/(?:x-icon|icon|ico)/.test(aURL)) {
       return aURL;
     }
     let width  = Math.round(aWidth * aWindow.devicePixelRatio);
     let height = Math.round(aHeight * aWindow.devicePixelRatio);
     return aURL + (aURL.contains("#") ? "&" : "#") +
            "-moz-resolution=" + width + "," + height;
   },