From 1333157a92006b9aed97eb42086a86eec0cec05d Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Thu, 3 Feb 2011 13:57:19 +0900 Subject: [PATCH] tabs from about:sessionrestore should be attached to the current tab (fix for https://github.com/piroor/treestyletab/issues#issue/35 ) --- content/treestyletab/treestyletabbrowser.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 33b0835d..4b3cfe29 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -2878,6 +2878,20 @@ TreeStyleTabBrowser.prototype = { onTabRestoring : function TSTBrowser_onTabRestoring(aEvent) { this.restoreStructure(aEvent.originalTarget); + + if (this.mTabBrowser.currentURI.spec == 'about:sessionrestore') { + let frame = this.mTabBrowser.contentWindow; + frame = frame.wrappedJSObject || frame; + let tree = frame.document.getElementById('tabList'); + let data = frame.gTreeData; + if (tree && data) { + let item = data[tree.currentIndex]; + window.setTimeout(function(aSelf, aTab, aTitle, aParent) { + if (aTab.label== aTitle) + aSelf.attachTabTo(aTab, aParent); + }, 0, this, aEvent.originalTarget, item.label, this.mTabBrowser.selectedTab); + } + } }, restoreStructure : function TSTBrowser_restoreStructure(aTab)