Bug 663395 - put tabs opened from pinned tabs at the end of the tab strip. r=gavin ui-r=faaborg

This commit is contained in:
Dão Gottwald 2011-07-21 04:36:02 +02:00
Родитель 67a6bb1970
Коммит 7c1aab0940
2 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -1372,15 +1372,19 @@
// aReferrerURI is null or undefined if the tab is opened from
// an external application or bookmark, i.e. somewhere other
// than the current tab.
if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
if (aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) {
let newTabPos = (this._lastRelatedTab ||
this.selectedTab)._tPos + 1;
if (this._lastRelatedTab)
this._lastRelatedTab.owner = null;
else
t.owner = this.selectedTab;
this.moveTabTo(t, newTabPos);
if (!this.selectedTab.pinned &&
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent"))
this.moveTabTo(t, newTabPos);
this._lastRelatedTab = t;
}

Просмотреть файл

@ -78,5 +78,14 @@ function test() {
testPosition(7, 8, "blank tab without referrer opens at the end");
testPosition(8, 9, "tab without referrer opens at the end");
gBrowser.selectedTab = tabs[0];
gBrowser.pinTab(gBrowser.selectedTab);
addTab("http://mochi.test:8888/#8", gBrowser.currentURI);
testPosition(9, 10, "tab with referrer should open at the end when the selected tab is pinned");
gBrowser.selectedTab = tabs[9];
gBrowser.removeTab(tabs.pop());
is(gBrowser.selectedTab, tabs[0],
"opening a tab from a pinned tab, selecting it and closing it should go back to the pinned tab");
tabs.forEach(gBrowser.removeTab, gBrowser);
}