From 7ffe6709d2804e961323edfecd3df5d398c44791 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Sun, 23 Sep 2012 17:19:09 +0900 Subject: [PATCH] Add failsafe for unexpectedly stored tab attribute "tabbrowser-id" --- modules/browser.js | 6 +++++- modules/utils.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/browser.js b/modules/browser.js index 9cfb594d..cc65a6d5 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -866,6 +866,7 @@ TreeStyleTabBrowser.prototype = { if (!aTab.hasAttribute(this.kID)) { let id = this.getTabValue(aTab, this.kID) || this.makeNewId(); aTab.setAttribute(this.kID, id); + aTab.setAttribute(this.kID_NEW, id); aTab.setAttribute(this.kSUBTREE_COLLAPSED, true); aTab.setAttribute(this.kALLOW_COLLAPSE, true); let self = this; @@ -877,6 +878,7 @@ TreeStyleTabBrowser.prototype = { if (aTab.getAttribute(self.kID) != id) return; + aTab.removeAttribute(this.kID_NEW); if (!self.getTabValue(aTab, self.kID)) { self.setTabValue(aTab, self.kID, id); if (!(id in self.tabsHash)) @@ -3608,7 +3610,9 @@ TreeStyleTabBrowser.prototype = { _restoreTabId : function TSTBrowser_restoreTabId(aTab) { - var currentId = aTab.getAttribute(this.kID); + // kID can be overridden by nsSessionStore. kID_NEW is for failsafe. + var currentId = aTab.getAttribute(this.kID_NEW) || aTab.getAttribute(this.kID); + aTab.removeAttribute(this.kID_NEW); var restoredId = this.getTabValue(aTab, this.kID); var mayBeDuplicated = false; diff --git a/modules/utils.js b/modules/utils.js index 9b726395..daa536af 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -96,6 +96,7 @@ var TreeStyleTabUtils = { kINSERT_AFTER : 'treestyletab-insert-after', kCLOSED_SET_ID : 'treestyletab-closed-set-id', + kID_NEW : 'treestyletab-id-new', kID_RESTORING : 'treestyletab-id-restoring', kCHILDREN_RESTORING : 'treestyletab-children-restoring',