From 7fb77b1e22fbd0878d105fcc197d2f343fbeb1c4 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Wed, 4 May 2011 23:13:37 +0900 Subject: [PATCH] trees around tabs duplicated by middle click on the "back" button were broken. --- content/treestyletab/treestyletabbrowser.js | 27 +++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 30104885..7eaa8599 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -3080,7 +3080,12 @@ TreeStyleTabBrowser.prototype = { tab.setAttribute(this.kID_RESTORING, id); if (this.isTabDuplicated(tab)) { mayBeDuplicated = true; - id = this.redirectId(id); + /** + * If the tab has its ID as the attribute, then we should use it + * instead of redirected ID, because the tab has been possibly + * attached to another tab. + */ + id = tab.getAttribute(this.kID) || this.redirectId(id); } tab.removeAttribute(this.kID_RESTORING); @@ -3096,15 +3101,17 @@ TreeStyleTabBrowser.prototype = { var closeSetId = null; if (!mayBeDuplicated) { closeSetId = this.getTabValue(tab, this.kCLOSED_SET_ID); - /* If it has a parent, it is wrongly attacched by tab moving - on restoring. Restoring the old ID (the next statement) - breaks the children list of the temporary parent and causes - many problems. So, to prevent these problems, I part the tab - from the temporary parent manually. - If the ID stored in the session equals to the value of the - attribute stored in the element itself, then don't reset the - tab, because the restoring session is got from the tab itself. - ( like SS.setTabState(tab, SS.getTabState(tab)) ) + /** + * If the tab is not a duplicated but it has a parent, then, + * it is wrongly attacched by tab moving on restoring. + * Restoring the old ID (the next statement) breaks the children + * list of the temporary parent and causes many problems. + * So, to prevent these problems, I part the tab from the temporary + * parent manually. + * If the ID stored in the session equals to the value of the + * attribute stored in the element itself, then don't reset the + * tab, because the restoring session is got from the tab itself. + * ( like SS.setTabState(tab, SS.getTabState(tab)) ) */ if (id != tab.getAttribute(this.kID)) this.resetTab(tab, false);