Bug 1370035 - Remove pending tab optimization now that tabs are injected lazily. r?dao
MozReview-Commit-ID: HTWVmFHtFv0
--- a/browser/base/content/tabbrowser.css
+++ b/browser/base/content/tabbrowser.css
@@ -84,26 +84,16 @@ tabpanels {
.closing-tabs-spacer {
pointer-events: none;
}
.tabbrowser-tabs:not(:hover) > .tabbrowser-arrowscrollbox > .closing-tabs-spacer {
transition: width .15s ease-out;
}
-/**
- * Optimization for tabs that are restored lazily. We can save a good amount of
- * memory that to-be-restored tabs would otherwise consume simply by setting
- * their browsers to 'display: none' as that will prevent them from having to
- * create a presentation and the like.
- */
-browser[pending] {
- display: none;
-}
-
browser[blank],
browser[pendingpaint] {
opacity: 0;
}
tabbrowser[pendingpaint] {
background-image: url(chrome://browser/skin/tabbrowser/pendingpaint.png);
background-repeat: no-repeat;
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3609,17 +3609,16 @@ var SessionStoreInternal = {
// Ensure the index is in bounds.
let activeIndex = (tabData.index || tabData.entries.length) - 1;
activeIndex = Math.min(activeIndex, tabData.entries.length - 1);
activeIndex = Math.max(activeIndex, 0);
// Save the index in case we updated it above.
tabData.index = activeIndex + 1;
- browser.setAttribute("pending", "true");
tab.setAttribute("pending", "true");
// If we're restoring this tab, it certainly shouldn't be in
// the ignored set anymore.
this._crashedBrowsers.delete(browser.permanentKey);
// Update the persistent tab state cache with |tabData| information.
TabStateCache.update(browser, {
@@ -3723,20 +3722,16 @@ var SessionStoreInternal = {
let uri = activePageData ? activePageData.url || null : null;
if (loadArguments) {
uri = loadArguments.uri;
if (loadArguments.userContextId) {
browser.setAttribute("usercontextid", loadArguments.userContextId);
}
}
- // We have to mark this tab as restoring first, otherwise
- // the "pending" attribute will be applied to the linked
- // browser, which removes it from the display list. We cannot
- // flip the remoteness of any browser that is not being displayed.
this.markTabAsRestoring(aTab);
// We need a new frameloader if we are reloading into a browser with a
// grouped session history (as we don't support restoring into browsers
// with grouped session histories directly).
let newFrameloader =
aOptions.newFrameloader || !!browser.frameLoader.groupedSHistory;
@@ -3798,17 +3793,16 @@ var SessionStoreInternal = {
// Make sure that this tab is removed from the priority queue.
TabRestoreQueue.remove(aTab);
// Increase our internal count.
this._tabsRestoringCount++;
// Set this tab's state to restoring
browser.__SS_restoreState = TAB_STATE_RESTORING;
- browser.removeAttribute("pending");
aTab.removeAttribute("pending");
},
/**
* This _attempts_ to restore the next available tab. If the restore fails,
* then we will attempt the next one.
* There are conditions where this won't do anything:
* if we're in the process of quitting
@@ -4551,17 +4545,16 @@ var SessionStoreInternal = {
// Keep the tab's previous state for later in this method
let previousState = browser.__SS_restoreState;
// The browser is no longer in any sort of restoring state.
delete browser.__SS_restoreState;
aTab.removeAttribute("pending");
- browser.removeAttribute("pending");
if (previousState == TAB_STATE_RESTORING) {
if (this._tabsRestoringCount)
this._tabsRestoringCount--;
} else if (previousState == TAB_STATE_NEEDS_RESTORE) {
// Make sure that the tab is removed from the list of tabs to restore.
// Again, this is normally done in restoreTabContent, but that isn't being called
// for this tab.
--- a/browser/components/sessionstore/test/browser_background_tab_crash.js
+++ b/browser/components/sessionstore/test/browser_background_tab_crash.js
@@ -93,17 +93,17 @@ async function crashBackgroundTabs(tabs)
await Promise.all(remotenessChangePromises);
await Promise.all(tabsRevived);
// Both background tabs should now be in the pending restore
// state.
for (let tab of tabs) {
Assert.ok(!tab.linkedBrowser.isRemoteBrowser, "tab is not remote");
Assert.ok(!tab.linkedBrowser.hasAttribute("crashed"), "tab is not crashed");
- Assert.ok(tab.linkedBrowser.hasAttribute("pending"), "tab is pending");
+ Assert.ok(tab.hasAttribute("pending"), "tab is pending");
}
}
add_task(async function setup() {
// We'll simplify by making sure we only ever one content process for this
// test.
await SpecialPowers.pushPrefEnv({ set: [[ "dom.ipc.processCount", 1 ]] });