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; + } ]]>