Bug 776928 - When doing lazy tab restoration, set the <browser>s in question to display:none until restored. r=dao

This commit is contained in:
Tim Taubert 2012-09-05 07:52:31 +02:00
parent 716e12df6a
commit 07d5947e7c
2 changed files with 15 additions and 0 deletions

View File

@ -53,3 +53,13 @@ tabpanels {
.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;
}

View File

@ -2987,6 +2987,7 @@ let SessionStoreInternal = {
// a tab gets closed before it's been properly restored
browser.__SS_data = tabData;
browser.__SS_restoreState = TAB_STATE_NEEDS_RESTORE;
browser.setAttribute("pending", "true");
tab.setAttribute("pending", "true");
// Make sure that set/getTabValue will set/read the correct data by
@ -3171,6 +3172,7 @@ let SessionStoreInternal = {
// Set this tab's state to restoring
browser.__SS_restoreState = TAB_STATE_RESTORING;
browser.removeAttribute("pending");
aTab.removeAttribute("pending");
// Remove the history listener, since we no longer need it once we start restoring
@ -4335,6 +4337,9 @@ let SessionStoreInternal = {
// The browser is no longer in any sort of restoring state.
delete browser.__SS_restoreState;
aTab.removeAttribute("pending");
browser.removeAttribute("pending");
// We want to decrement window.__SS_tabsToRestore here so that we always
// decrement it AFTER a tab is done restoring or when a tab gets "reset".
window.__SS_tabsToRestore--;