From ee95b8c7c06b33ed76d1375aafa3cee4499b68ec Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Fri, 29 Jul 2011 09:45:21 +0900 Subject: [PATCH] closing a child tab when there are multiple child tabs next to it focuses the parent tab instead of the child tab next to the one closed --- modules/browser.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/browser.js b/modules/browser.js index 23c5696e..02e2cadd 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -2469,9 +2469,18 @@ TreeStyleTabBrowser.prototype = { parent = pareintIndexInTree < tabs.length ? tabs[pareintIndexInTree] : parent ; } if (parent) { + let lastRelatedTab = b._lastRelatedTab; this.attachTabTo(tab, parent, { dontExpand : this.shouldExpandAllTree }); + /** + * gBrowser.addTab() resets gBrowser._lastRelatedTab.owner + * when a new background tab is opened from links in the current + * tab, but it will fail with TST because moveTab() clears + * gBrowser._lastRelatedTab. + * So, we have to restore gBrowser._lastRelatedTab manually. + */ + b._lastRelatedTab = lastRelatedTab; } let refTab; @@ -2498,7 +2507,16 @@ TreeStyleTabBrowser.prototype = { if (newIndex > -1) { if (newIndex > tab._tPos) newIndex--; this.internallyTabMovingCount++; + let lastRelatedTab = b._lastRelatedTab; b.moveTabTo(tab, newIndex); + /** + * gBrowser.addTab() resets gBrowser._lastRelatedTab.owner + * when a new background tab is opened from links in the current + * tab, but it will fail with TST because moveTab() clears + * gBrowser._lastRelatedTab. + * So, we have to restore gBrowser._lastRelatedTab manually. + */ + b._lastRelatedTab = lastRelatedTab; this.internallyTabMovingCount--; }