Bug 1256472 - Account for the possibility that the selectedTab has not yet presented when initting async tab switcher. r?billm draft
authorMike Conley <mconley@mozilla.com>
Fri, 17 Mar 2017 18:58:57 -0400
changeset 502322 ab383ce6e84b51955d9b689b33a3583e76a9f225
parent 502321 a5078f647337193a9ec2d496efaf599748a88910
child 502323 e32025cfd42aa58baedec2b6e16629cba4002543
push id50256
push usermconley@mozilla.com
push dateTue, 21 Mar 2017 17:20:57 +0000
reviewersbillm
bugs1256472
milestone55.0a1
Bug 1256472 - Account for the possibility that the selectedTab has not yet presented when initting async tab switcher. r?billm MozReview-Commit-ID: 1mXffrdUBOE
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3828,18 +3828,26 @@
               window.addEventListener("MozAfterPaint", this);
               window.addEventListener("MozLayerTreeReady", this);
               window.addEventListener("MozLayerTreeCleared", this);
               window.addEventListener("TabRemotenessChange", this);
               window.addEventListener("sizemodechange", this);
               window.addEventListener("SwapDocShells", this, true);
               window.addEventListener("EndSwapDocShells", this, true);
               window.addEventListener("MozTabChildNotReady", this, true);
+
+              let tab = this.requestedTab;
+              let browser = tab.linkedBrowser;
+              let tabIsLoaded = !browser.isRemoteBrowser ||
+                                browser.frameLoader.tabParent.hasPresented;
+
               if (!this.minimized) {
-                this.setTabState(this.requestedTab, this.STATE_LOADED);
+                this.log("Initial tab is loaded?: " + tabIsLoaded);
+                this.setTabState(tab, tabIsLoaded ? this.STATE_LOADED
+                                                  : this.STATE_LOADING);
               }
             },
 
             destroy() {
               if (this.unloadTimer) {
                 this.clearTimer(this.unloadTimer);
                 this.unloadTimer = null;
               }