Bug 1351677 - Show blank instead of a spinner if switching to a tab we've never seen for the first time. r?billm
This is mostly for the case when restoring a window, where the tab selection changes during the
restoration. In order to avoid a tab switch spinner, we now show a blank tab if the tab is loading,
and has either never been seen OR has told us that its TabChild is not yet ready.
MozReview-Commit-ID: 7bLnjq32ak6
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3953,20 +3953,34 @@
this.tabbrowser.dispatchEvent(event);
},
// This function is called after all the main state changes to
// make sure we display the right tab.
updateDisplay() {
let requestedTabState = this.getTabState(this.requestedTab);
+ // We can blank out the tab if:
+ //
+ // 1) We've never seen the contents of this tab before.
+ // 2) We know that a TabChild hasn't been set up yet for this tab,
+ // so painting cannot be forced.
+ //
+ // For (1), this means that tabs that are loaded in the background
+ // might show a quick flash of blank when switching to them for the
+ // first time (and only the first time).
+ let requestedBrowser = this.requestedTab.linkedBrowser;
let shouldBeBlank =
- this.pendingTabChild.has(this.requestedTab.linkedBrowser) &&
+ ((requestedBrowser.isRemoteBrowser &&
+ !requestedBrowser.frameLoader.tabParent.hasPresented) ||
+ this.pendingTabChild.has(requestedBrowser)) &&
requestedTabState == this.STATE_LOADING;
+ this.log("shouldBeBlank: " + shouldBeBlank);
+
// Figure out which tab we actually want visible right now.
let showTab = null;
if (requestedTabState != this.STATE_LOADED &&
this.lastVisibleTab && this.loadTimer && !shouldBeBlank) {
// If we can't show the requestedTab, and lastVisibleTab is
// available, show it.
showTab = this.lastVisibleTab;
} else {