Bug 1380150 - Prevent subsequent loads on a page after the initial page load has completed from showing the progress indicator on the tab. This will prevent the favicon from flickering. r?gijs draft
authorJared Wein <jwein@mozilla.com>
Tue, 05 Sep 2017 17:47:23 -0400
changeset 659306 207d1b47960db3e3fe282acb7c51856faa3e840b
parent 659249 b800c495318be6473033f96af7786576dbb30d34
child 729966 7c1973c6b7fb4b34cdba999079cf5089c1917f5c
push id78104
push userbmo:jaws@mozilla.com
push dateTue, 05 Sep 2017 21:47:46 +0000
reviewersgijs
bugs1380150
milestone57.0a1
Bug 1380150 - Prevent subsequent loads on a page after the initial page load has completed from showing the progress indicator on the tab. This will prevent the favicon from flickering. r?gijs MozReview-Commit-ID: 69YDfywyeLn
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -565,16 +565,17 @@
             mBrowser: aBrowser,
             mBlank: aStartsBlank,
 
             // cache flags for correct status UI update after tab switching
             mStateFlags: stateFlags,
             mStatus: 0,
             mMessage: "",
             mTotalProgress: 0,
+            mInitialLoadComplete: false,
 
             // count of open requests (should always be 0 or 1)
             mRequestCount: 0,
 
             destroy() {
               delete this.mTab;
               delete this.mBrowser;
               delete this.mTabBrowser;
@@ -591,16 +592,20 @@
 
               // Don't show progress indicators in tabs for about: URIs
               // pointing to local resources.
               if ((aRequest instanceof Ci.nsIChannel) &&
                   this.mTabBrowser._isLocalAboutURI(aRequest.originalURI, aRequest.URI)) {
                 return false;
               }
 
+              // Don't show progress after the initial load to prevent flickering of the favicon.
+              if (this.mInitialLoadComplete)
+                return false;
+
               return true;
             },
 
             _isForInitialAboutBlank(aWebProgress, aStateFlags, aLocation) {
               if (!this.mBlank || !aWebProgress.isTopLevel) {
                 return false;
               }
 
@@ -660,16 +665,19 @@
               this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
 
               if (!this._shouldShowProgress(aRequest))
                 return;
 
               if (this.mTotalProgress)
                 this.mTab.setAttribute("progress", "true");
 
+              if (this.mTotalProgress == 1)
+                this.mInitialLoadComplete = true;
+
               this._callProgressListeners("onProgressChange",
                                           [aWebProgress, aRequest,
                                            aCurSelfProgress, aMaxSelfProgress,
                                            aCurTotalProgress, aMaxTotalProgress]);
             },
 
             onProgressChange64(aWebProgress, aRequest,
                                aCurSelfProgress, aMaxSelfProgress,
@@ -741,16 +749,19 @@
                     // page in the browser is about:blank (indicating it is a newly
                     // created or re-created browser, e.g. because it just switched
                     // remoteness or is a new tab/window).
                     this.mBrowser.urlbarChangeTracker.startedLoad();
                   }
                   delete this.mBrowser.initialPageLoadedFromURLBar;
                   // If the browser is loading it must not be crashed anymore
                   this.mTab.removeAttribute("crashed");
+
+                  let listener = this.mTabBrowser._tabListeners.get(this.mTab);
+                  this.mInitialLoadComplete = false;
                 }
 
                 if (this._shouldShowProgress(aRequest)) {
                   if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
                     this.mTab.setAttribute("busy", "true");
                     this._syncProgressAnimations();
                   }