Bug 1443315 - Don't set docShellIsActive to false for preloaded browsers that are being inserted. r?dao draft
authorMike Conley <mconley@mozilla.com>
Tue, 06 Mar 2018 14:37:27 -0500
changeset 763895 32b48514a6ce1db07f310bedd33cb5bb6137661e
parent 763888 6ef922f441e93dc3cc3e444b4ead357700144ca5
push id101591
push usermconley@mozilla.com
push dateTue, 06 Mar 2018 20:46:42 +0000
reviewersdao
bugs1443315
milestone60.0a1
Bug 1443315 - Don't set docShellIsActive to false for preloaded browsers that are being inserted. r?dao MozReview-Commit-ID: LxZ9qaG1ls7
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -2072,19 +2072,29 @@ class TabBrowser {
       .createInstance(Ci.nsIWebProgress);
     filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL);
     browser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
     this._tabListeners.set(aTab, tabListener);
     this._tabFilters.set(aTab, filter);
 
     browser.droppedLinkHandler = handleDroppedLink;
 
-    // We start our browsers out as inactive, and then maintain
-    // activeness in the tab switcher.
-    browser.docShellIsActive = false;
+    // Most of the time, we start our browser's docShells out as inactive,
+    // and then maintain activeness in the tab switcher. Preloaded about:newtab's
+    // are already created with their docShell's as inactive, but then explicitly
+    // render their layers to ensure that we can switch to them quickly. We avoid
+    // setting docShellIsActive to false again in this case, since that'd cause
+    // the layers for the preloaded tab to be dropped, and we'd see a flash
+    // of empty content instead.
+    //
+    // So for all browsers except for the preloaded case, we set the browser
+    // docShell to inactive.
+    if (!usingPreloadedContent) {
+      browser.docShellIsActive = false;
+    }
 
     // When addTab() is called with an URL that is not "about:blank" we
     // set the "nodefaultsrc" attribute that prevents a frameLoader
     // from being created as soon as the linked <browser> is inserted
     // into the DOM. We thus have to register the new outerWindowID
     // for non-remote browsers after we have called browser.loadURI().
     if (remoteType == E10SUtils.NOT_REMOTE) {
       this._outerWindowIDBrowserMap.set(browser.outerWindowID, browser);