Bug 1408026 - Opening of new tabs is slower if Activity Stream is enabled draft
authorUrsula Sarracini
Thu, 12 Oct 2017 16:19:59 -0400
changeset 679517 6a68ce27846a1d9347021f7a54dda60fb8179dc3
parent 679509 98247fbf95c260786361e12ad924c4370885f686
child 735624 3e11fe539d57a58c024968465e484da98d98e366
push id84249
push userusarracini@mozilla.com
push dateThu, 12 Oct 2017 20:21:57 +0000
bugs1408026
milestone58.0a1
Bug 1408026 - Opening of new tabs is slower if Activity Stream is enabled MozReview-Commit-ID: CXEDtNOLPUE
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4514,28 +4514,33 @@
               if (requestedBrowser.isRemoteBrowser) {
                 // If a tab is remote and the window is not minimized, we can show a
                 // blank tab instead of a spinner in the following cases:
                 //
                 // 1. The tab has just crashed, and we haven't started showing the
                 //    tab crashed page yet (in this case, the TabParent is null)
                 // 2. The tab has never presented, and has not finished loading
                 //    a non-local-about: page.
+                // 3. The request tab is about:newtab i.e we are opening a newtab. In
+                //    this case we want to wait until it's loaded until we switch to it
+                //    to avoid showing a flash before rendering content
                 //
                 // For (2), "finished loading a non-local-about: page" is
                 // determined by the busy state on the tab element and checking
                 // if the loaded URI is local.
                 let hasSufficientlyLoaded =
                   !this.requestedTab.hasAttribute("busy") &&
                   !this.tabbrowser._isLocalAboutURI(requestedBrowser.currentURI);
 
                 let fl = requestedBrowser.frameLoader;
+                let isNewTab = requestedBrowser.currentURI.spec === "about:newtab"
                 shouldBeBlank = !this.minimizedOrFullyOccluded &&
                                 (!fl.tabParent ||
-                                 (!hasSufficientlyLoaded && !fl.tabParent.hasPresented));
+                                (!hasSufficientlyLoaded && !fl.tabParent.hasPresented)) &&
+                                !isNewTab;
               }
 
               this.log("Tab should be blank: " + shouldBeBlank);
               this.log("Requested tab is remote?: " + requestedBrowser.isRemoteBrowser);
 
               // Figure out which tab we actually want visible right now.
               let showTab = null;
               if (requestedTabState != this.STATE_LOADED &&