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
--- 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();
}