mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 04:22:56 +00:00
Bug 307126 Closing tabs should return to 'parent' tab.
r=db48x sr=neil
This commit is contained in:
parent
999cdf8221
commit
9660abcf21
@ -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)
|
||||
|
@ -137,6 +137,9 @@
|
||||
<field name="mCurrentTab">
|
||||
null
|
||||
</field>
|
||||
<field name="mPreviousTab">
|
||||
null
|
||||
</field>
|
||||
<field name="mCurrentBrowser">
|
||||
null
|
||||
</field>
|
||||
@ -542,6 +545,10 @@
|
||||
<method name="updateCurrentBrowser">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// we only want to return to the parent tab if no other
|
||||
// tabs have been opened and the user hasn't switched tabs
|
||||
this.mPreviousTab = null;
|
||||
|
||||
var newBrowser = this.mPanelContainer.childNodes[this.mPanelContainer.selectedIndex];
|
||||
if (this.mCurrentBrowser) {
|
||||
// Only save the focused element if it is in our content window
|
||||
@ -842,6 +849,7 @@
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
<parameter name="aCharset"/>
|
||||
<parameter name="aFocusNewTab"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var t = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
||||
@ -896,6 +904,16 @@
|
||||
b.loadURI(aURI, aReferrerURI, aCharset);
|
||||
}
|
||||
|
||||
if (aFocusNewTab) {
|
||||
var parentTab = this.selectedTab;
|
||||
this.selectedTab = t;
|
||||
this.mPreviousTab = parentTab;
|
||||
}
|
||||
else
|
||||
// The user opened a background tab, so updateCurrentBrowser
|
||||
// won't be called. Explicitly clear the previous tab.
|
||||
this.mPreviousTab = null;
|
||||
|
||||
return t;
|
||||
]]>
|
||||
</body>
|
||||
@ -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;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
Loading…
x
Reference in New Issue
Block a user