don't save tree structure if the fast restoring is disabled

This commit is contained in:
SHIMODA Hiroshi 2011-01-20 12:08:25 +09:00
parent 19c22d2875
commit 665355599d

View File

@ -1894,11 +1894,51 @@ TreeStyleTabBrowser.prototype = {
onWindowStateRestored : function TSTBrowser_onWindowStateRestored() onWindowStateRestored : function TSTBrowser_onWindowStateRestored()
{ {
if ( if (!window.__SS_tabsToRestore)
!window.__SS_tabsToRestore ||
!this.getTreePref('restoreTreeOnStartup')
)
return; return;
},
saveTreeStructureWithDelay : function TSTBrowser_saveTreeStructureWithDelay()
{
if (this.restoringTree || this.saveTreeStructureWithDelayTimer)
return;
this.saveTreeStructureWithDelayTimer = window.setTimeout(function(aSelf) {
aSelf.saveTreeStructureWithDelayTimer = null;
aSelf.saveTreeStructure();
}, this.getPref('browser.sessionstore.interval'), this);
},
saveTreeStructureWithDelayTimer : null,
saveTreeStructure : function TSTBrowser_saveTreeStructure()
{
if (!this.getTreePref('restoreTreeOnStartup'))
return;
var treeStructures = JSON.parse(this.SessionStore.getWindowValue(window, this.kSTRUCTURE) || '{}');
var id = this.mTabBrowser.getAttribute('id');
var tabs = this.getAllTabsArray(this.mTabBrowser);
treeStructures[id] = {
tree : this.getTreeStructureFromTabs(tabs),
collapsed : tabs.filter(function(aTab) {
return this.isCollapsed(aTab);
}, this).map(function(aTab) {
return aTab._tPos;
}),
treeCollapsed : tabs.filter(function(aTab) {
return this.isSubtreeCollapsed(aTab);
}, this).map(function(aTab) {
return aTab._tPos;
})
};
this.SessionStore.setWindowValue(window, this.kSTRUCTURE, JSON.stringify(treeStructures))
},
restoreTreeStructure : function TSTBrowser_restoreTreeStructure()
{
if (!this.getTreePref('restoreTreeOnStartup'))
return;
this.restoreTreeStructure();
var treeStructures = JSON.parse(this.SessionStore.getWindowValue(window, this.kSTRUCTURE) || '{}'); var treeStructures = JSON.parse(this.SessionStore.getWindowValue(window, this.kSTRUCTURE) || '{}');
var id = this.mTabBrowser.getAttribute('id'); var id = this.mTabBrowser.getAttribute('id');
@ -1928,41 +1968,6 @@ TreeStyleTabBrowser.prototype = {
}, this); }, this);
}, },
saveTreeStructureWithDelay : function TSTBrowser_saveTreeStructureWithDelay()
{
if (this.restoringTree)
return;
if (this.saveTreeStructureWithDelayTimer)
window.clearTimeout(this.saveTreeStructureWithDelayTimer);
this.saveTreeStructureWithDelayTimer = window.setTimeout(function(aSelf) {
aSelf.saveTreeStructureWithDelayTimer = null;
aSelf.saveTreeStructure();
}, this.getPref('browser.sessionstore.interval'), this);
},
saveTreeStructureWithDelayTimer : null,
saveTreeStructure : function TSTBrowser_saveTreeStructure()
{
var treeStructures = JSON.parse(this.SessionStore.getWindowValue(window, this.kSTRUCTURE) || '{}');
var id = this.mTabBrowser.getAttribute('id');
var tabs = this.getAllTabsArray(this.mTabBrowser);
treeStructures[id] = {
tree : this.getTreeStructureFromTabs(tabs),
collapsed : tabs.filter(function(aTab) {
return this.isCollapsed(aTab);
}, this).map(function(aTab) {
return aTab._tPos;
}),
treeCollapsed : tabs.filter(function(aTab) {
return this.isSubtreeCollapsed(aTab);
}, this).map(function(aTab) {
return aTab._tPos;
})
};
this.SessionStore.setWindowValue(window, this.kSTRUCTURE, JSON.stringify(treeStructures))
},
/* DOM Event Handling */ /* DOM Event Handling */
handleEvent : function TSTBrowser_handleEvent(aEvent) handleEvent : function TSTBrowser_handleEvent(aEvent)