if we can restore tree more quickly, do it

This commit is contained in:
SHIMODA Hiroshi 2011-12-13 16:32:42 +09:00
parent 4c51a856b1
commit e21c0f4d01

View File

@ -89,6 +89,8 @@ TreeStyleTabBrowser.prototype = {
maxTreeLevelPhisical : false, maxTreeLevelPhisical : false,
needRestoreTree : true,
/* elements */ /* elements */
get browser() get browser()
@ -2047,11 +2049,9 @@ TreeStyleTabBrowser.prototype = {
} }
return; return;
/*
case 'sessionstore-windows-restored': case 'sessionstore-windows-restored':
case 'sessionstore-browser-state-restored': case 'sessionstore-browser-state-restored':
return this.onWindowStateRestored(); return this.onWindowStateRestored();
*/
case 'private-browsing-change-granted': case 'private-browsing-change-granted':
this.collapseExpandAllSubtree(false, true); this.collapseExpandAllSubtree(false, true);
@ -2285,6 +2285,16 @@ TreeStyleTabBrowser.prototype = {
onWindowStateRestored : function TSTBrowser_onWindowStateRestored() onWindowStateRestored : function TSTBrowser_onWindowStateRestored()
{ {
this.restoreTree(true);
},
restoreTree : function TSTBrowser_restoreTree(aForceRestore)
{
if (!this.needRestoreTree && !aForceRestore)
return;
this.needRestoreTree = false;
if (!this.window.__SS_tabsToRestore || this.window.__SS_tabsToRestore <= 1) if (!this.window.__SS_tabsToRestore || this.window.__SS_tabsToRestore <= 1)
return; return;
@ -2471,12 +2481,7 @@ TreeStyleTabBrowser.prototype = {
case 'SSWindowStateBusy': case 'SSWindowStateBusy':
let (self = this) { return this.needRestoreTree = true;
this.Deferred.next(function() {
self.onWindowStateRestored();
});
}
return;
case 'nsDOMMultipleTabHandlerTabsClosing': case 'nsDOMMultipleTabHandlerTabsClosing':
@ -3224,6 +3229,8 @@ TreeStyleTabBrowser.prototype = {
onTabRestoring : function TSTBrowser_onTabRestoring(aEvent) onTabRestoring : function TSTBrowser_onTabRestoring(aEvent)
{ {
this.restoreTree();
this.handleRestoredTab(aEvent.originalTarget); this.handleRestoredTab(aEvent.originalTarget);
/** /**