Bug 1265708 - Strip ref from URL when adding homescreen icons r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 03 Jun 2016 14:05:29 -0700
changeset 341423 971e29d3b65c788142eb09b900c98279fd38a732
parent 341422 1888dfa820b765ff63f7a5c1c223857100fe9d98
child 341424 3eaa539ca29456dbe29a2467638e0fe8f08dec88
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1265708
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 &&