Fix broken tree which can appear after a tab is duplicated as a child of the original tab

This commit is contained in:
Piro / YUKI Hiroshi 2012-09-23 17:59:19 +09:00
parent 7ffe6709d2
commit bf068dfdab

View File

@ -2037,7 +2037,8 @@ TreeStyleTabBrowser.prototype = {
destroyTab : function TSTBrowser_destroyTab(aTab) destroyTab : function TSTBrowser_destroyTab(aTab)
{ {
var id = aTab.getAttribute(this.kID); var id = aTab.getAttribute(this.kID);
if (id in this.tabsHash) if (id in this.tabsHash &&
aTab == this.tabsHash[id])
delete this.tabsHash[id]; delete this.tabsHash[id];
if (aTab.__treestyletab__checkTabsIndentOverflowOnMouseLeave) { if (aTab.__treestyletab__checkTabsIndentOverflowOnMouseLeave) {
@ -3572,7 +3573,10 @@ TreeStyleTabBrowser.prototype = {
// remove temporary cache // remove temporary cache
var currentId = aTab.getAttribute(this.kID); var currentId = aTab.getAttribute(this.kID);
if (id != currentId && currentId && currentId in this.tabsHash) if (id != currentId &&
currentId &&
currentId in this.tabsHash &&
this.tabsHash[currentId] == aTab)
delete this.tabsHash[currentId]; delete this.tabsHash[currentId];
this.setTabValue(aTab, this.kID, id); this.setTabValue(aTab, this.kID, id);
@ -3582,7 +3586,6 @@ TreeStyleTabBrowser.prototype = {
this._fixMissingAttributesFromSessionData(aTab); this._fixMissingAttributesFromSessionData(aTab);
} }
else { else {
let isSubtreeCollapsed = this._restoreSubtreeCollapsedState(aTab); let isSubtreeCollapsed = this._restoreSubtreeCollapsedState(aTab);
let restoringMultipleTabs = this.windowService.restoringTree; let restoringMultipleTabs = this.windowService.restoringTree;