Bug 1035131 - User decoded user entered URLs in suggeste image lookups. r=mfinkle, a=lmandel
authorLucas Rocha <lucasr@mozilla.com>
Mon, 07 Jul 2014 15:59:53 +0100
changeset 207883 5ece78da865bca6cc7aa14a3798f75de66230bad
parent 207882 2ffb6fe3448419d9680bce6930b117080088c45f
child 207884 867e77cc2342c3c79f9e58af924864cfff11f43f
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lmandel
bugs1035131
milestone32.0a2
Bug 1035131 - User decoded user entered URLs in suggeste image lookups. r=mfinkle, a=lmandel
mobile/android/base/home/TopSitesPanel.java
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -544,21 +544,24 @@ public class TopSitesPanel extends HomeF
             // Thumbnails are delivered late, so we can't short-circuit any
             // sooner than this. But we can avoid a duplicate favicon
             // fetch...
             if (!updated) {
                 debug("bindView called twice for same values; short-circuiting.");
                 return;
             }
 
+            // Make sure we query suggested images without the user-entered wrapper.
+            final String decodedUrl = StringUtils.decodeUserEnteredUrl(url);
+
             // Suggested images have precedence over thumbnails, no need to wait
             // for them to be loaded. See: CursorLoaderCallbacks.onLoadFinished()
-            final String imageUrl = BrowserDB.getSuggestedImageUrlForUrl(url);
+            final String imageUrl = BrowserDB.getSuggestedImageUrlForUrl(decodedUrl);
             if (!TextUtils.isEmpty(imageUrl)) {
-                final int bgColor = BrowserDB.getSuggestedBackgroundColorForUrl(url);
+                final int bgColor = BrowserDB.getSuggestedBackgroundColorForUrl(decodedUrl);
                 view.displayThumbnail(imageUrl, bgColor);
                 return;
             }
 
             // If thumbnails are still being loaded, don't try to load favicons
             // just yet. If we sent in a thumbnail, we're done now.
             if (mThumbnails == null || thumbnail != null) {
                 return;