Bug 1443315 - Don't set docShellIsActive to false for preloaded browsers that are being inserted. r?dao
MozReview-Commit-ID: LxZ9qaG1ls7
--- 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);