Bug 1265708 - Strip ref from URL when adding homescreen icons r=sebastian
☠☠ backed out by 130b03d8de24 ☠ ☠
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 03 Jun 2016 14:05:29 -0700
changeset 324862 e994f70de0490e77a2309793852434f2f1641ad7
parent 324861 047961bdb4adf91179be3b8a983cffc0d8e9debb
child 324863 10fa130289d70f0adb8ad8379d3454976c922049
push id9671
push userraliiev@mozilla.com
push dateMon, 06 Jun 2016 20:27:52 +0000
treeherdermozilla-aurora@cea65ca3d0bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1265708
milestone49.0a1
Bug 1265708 - Strip ref from URL when adding homescreen icons r=sebastian We add URL metadata based on the base URL, we should retrieve it this way too. MozReview-Commit-ID: ICP54V5vRgv
mobile/android/base/java/org/mozilla/gecko/favicons/Favicons.java
--- a/mobile/android/base/java/org/mozilla/gecko/favicons/Favicons.java
+++ b/mobile/android/base/java/org/mozilla/gecko/favicons/Favicons.java
@@ -12,16 +12,17 @@ import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.URLMetadataTable;
 import org.mozilla.gecko.favicons.cache.FaviconCache;
 import org.mozilla.gecko.util.GeckoJarReader;
 import org.mozilla.gecko.util.NonEvictingLruCache;
+import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.drawable.BitmapDrawable;
@@ -624,23 +625,25 @@ public class Favicons {
      * This implementation sidesteps the cache and will load the icon from the database or the
      * internet. See getPreferredSizeFaviconForPage().
      */
     public static void getPreferredIconForHomeScreenShortcut(Context context, String url, OnFaviconLoadedListener onFaviconLoadedListener) {
         ThreadUtils.assertOnBackgroundThread();
 
         final BrowserDB db = GeckoProfile.get(context).getDB();
 
+        final String metadataQueryURL = StringUtils.stripRef(url);
+
         final ContentResolver cr = context.getContentResolver();
         final Map<String, Map<String, Object>> metadata = db.getURLMetadata().getForURLs(cr,
-                Collections.singletonList(url),
+                Collections.singletonList(metadataQueryURL),
                 Collections.singletonList(URLMetadataTable.TOUCH_ICON_COLUMN)
         );
 
-        final Map<String, Object> row = metadata.get(url);
+        final Map<String, Object> row = metadata.get(metadataQueryURL);
 
         String touchIconURL = null;
 
         if (row != null) {
             touchIconURL = (String) row.get(URLMetadataTable.TOUCH_ICON_COLUMN);
         }
 
         if (touchIconURL != null &&