From 2eb72d5d58fea6f352d47e88ea1fda8763210876 Mon Sep 17 00:00:00 2001 From: "cst%andrew.cmu.edu" Date: Fri, 21 Oct 2005 03:28:56 +0000 Subject: [PATCH] Bug 307126 Closing tabs should return to 'parent' tab. r=db48x sr=neil git-svn-id: svn://10.0.0.236/trunk@182687 18797224-902f-48f8-a5cc-f745e15eee43 --- .../resources/content/contentAreaUtils.js | 8 ++--- .../resources/content/bindings/tabbrowser.xml | 34 ++++++++++++++++--- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js b/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js index 1127ee593b0..779846e46db 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js +++ b/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js @@ -165,15 +165,13 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref) } // open link in new tab - var tab = browser.addTab(url, referrer, originCharset); + var loadInBackground = false; if (pref) { - var loadInBackground = pref.getBoolPref("browser.tabs.loadInBackground"); + loadInBackground = pref.getBoolPref("browser.tabs.loadInBackground"); if (reverseBackgroundPref) loadInBackground = !loadInBackground; - - if (!loadInBackground) - browser.selectedTab = tab; } + browser.addTab(url, referrer, originCharset, !loadInBackground); } // Clientelle: (Make sure you don't break any of these) diff --git a/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml b/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml index 6ba05191040..935dc0a16df 100644 --- a/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml +++ b/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml @@ -137,6 +137,9 @@ null + + null + null @@ -542,6 +545,10 @@ + @@ -1045,11 +1063,19 @@ // When the current tab is removed select a new tab // and fire select events on tabpanels and tabs - this.mTabContainer.selectedIndex = newIndex; + if (this.mPreviousTab && (oldTab == this.mCurrentTab)) + this.selectedTab = this.mPreviousTab; + else { + this.mTabContainer.selectedIndex = newIndex; - // When removing a tab to the left of the current tab - // fix up the panel index without firing any events - this.mPanelContainer.selectedIndex = newIndex; + // When removing a tab to the left of the current tab + // fix up the panel index without firing any events + this.mPanelContainer.selectedIndex = newIndex; + + // We need to explicitly clear this, because updateCurrentBrowser + // doesn't get called for a background tab + this.mPreviousTab = null; + } ]]>