Bug 1301031 - Tab: Initialize icon request builder in constructor. r?ahunt draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 07 Sep 2016 13:47:38 +0200
changeset 411001 456571cc4c1d4bb6ab51cda92f3c09ba524e7ef3
parent 410870 91c2b9d5c1354ca79e5b174591dbb03b32b15bbf
child 412069 7ea6b4ddc21cab64a990f24000e4a5eb552854c4
child 412295 4f993966cefae1f040f11c4ae45a6460a9df8596
push id28814
push users.kaspari@gmail.com
push dateWed, 07 Sep 2016 11:48:39 +0000
reviewersahunt
bugs1301031
milestone51.0a1
Bug 1301031 - Tab: Initialize icon request builder in constructor. r?ahunt MozReview-Commit-ID: G6n4BAC2P17
mobile/android/base/java/org/mozilla/gecko/Tab.java
--- a/mobile/android/base/java/org/mozilla/gecko/Tab.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tab.java
@@ -135,16 +135,17 @@ public class Tab {
         mTitle = title == null ? "" : title;
         mSiteIdentity = new SiteIdentity();
         mHistoryIndex = -1;
         mContentType = "";
         mZoomConstraints = new ZoomConstraints(false);
         mPluginViews = new ArrayList<View>();
         mState = shouldShowProgress(url) ? STATE_LOADING : STATE_SUCCESS;
         mLoadProgress = LOAD_PROGRESS_INIT;
+        mIconRequestBuilder = Icons.with(mAppContext).pageUrl(mUrl);
 
         updateBookmark();
     }
 
     private ContentResolver getContentResolver() {
         return mAppContext.getContentResolver();
     }
 
@@ -447,23 +448,16 @@ public class Tab {
     }
 
     public void loadFavicon() {
         // Static Favicons never change
         if (AboutPages.isBuiltinIconPage(mUrl) && mFavicon != null) {
             return;
         }
 
-        if (mIconRequestBuilder == null) {
-            // For the first internal homepage we might want to load a favicon without ever receiving
-            // a location change event first. In this case we didn't start to build a request yet.
-            // Let's do that now.
-            mIconRequestBuilder = Icons.with(mAppContext).pageUrl(mUrl);
-        }
-
         mRunningIconRequest = mIconRequestBuilder
                 .build()
                 .execute(new IconCallback() {
                     @Override
                     public void onIconResponse(IconResponse response) {
                         mFavicon = response.getBitmap();
 
                         Tabs.getInstance().notifyListeners(Tab.this, Tabs.TabEvents.FAVICON);