Bug 1277854 - Back out
bug 1276050 to ensure we load only local favicons whe requested r?sebastian
(Backed out changeset 9575e608cabe)
loadUncachedFavicon allows loading favicons from the internet, whereas
getSizedFaviconForPageFromLocal restricts itself to the favicon cache.
(LoadFaviconTask's last parameter is (boolean) onlyFromLocal, which is
set to true in getSizedFaviconForPageFromLocal.
We could probably replace this with an Enum to make the parameter's purpose
more obvious.
MozReview-Commit-ID: C9uwcG0h0N
--- a/mobile/android/base/java/org/mozilla/gecko/favicons/Favicons.java
+++ b/mobile/android/base/java/org/mozilla/gecko/favicons/Favicons.java
@@ -301,17 +301,25 @@ public class Favicons {
final Bitmap result = getSizedFaviconFromCache(targetURL, targetSize);
if (result != null) {
// Victory - immediate response!
return dispatchResult(pageURL, targetURL, result, callback);
}
}
// No joy using in-memory resources. Go to background thread and ask the database.
- return loadUncachedFavicon(context, pageURL, targetURL, 0, targetSize, callback);
+ final LoadFaviconTask task =
+ new LoadFaviconTask(context, pageURL, targetURL, 0, callback, targetSize, true);
+ final int taskId = task.getId();
+ synchronized (loadTasks) {
+ loadTasks.put(taskId, task);
+ }
+ task.execute();
+
+ return taskId;
}
public static int getSizedFaviconForPageFromLocal(Context context, final String pageURL, final OnFaviconLoadedListener callback) {
return getSizedFaviconForPageFromLocal(context, pageURL, defaultFaviconSize, callback);
}
/**
* Helper method to determine the URL of the Favicon image for a given page URL by querying the