зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504274 - Close Tabs to the Right in a multiselect context should close all tabs to the right of the contextual tab that are not selected. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D11250 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6edfdf2ae9
Коммит
938dee6e20
|
@ -2658,22 +2658,17 @@ window._gBrowser = {
|
|||
},
|
||||
|
||||
getTabsToTheEndFrom(aTab) {
|
||||
let tab;
|
||||
if (aTab.multiselected) {
|
||||
// In a multi-select context, pick the rightmost
|
||||
// selected tab as reference.
|
||||
let selectedTabs = this.selectedTabs;
|
||||
tab = selectedTabs[selectedTabs.length - 1];
|
||||
} else {
|
||||
tab = aTab;
|
||||
}
|
||||
|
||||
let tabsToEnd = [];
|
||||
let tabs = this.visibleTabs;
|
||||
for (let i = tabs.length - 1; i >= 0; --i) {
|
||||
if (tabs[i] == tab || tabs[i].pinned) {
|
||||
if (tabs[i] == aTab || tabs[i].pinned) {
|
||||
break;
|
||||
}
|
||||
// In a multi-select context, select all unselected tabs
|
||||
// starting from the context tab.
|
||||
if (aTab.multiselected && tabs[i].multiselected) {
|
||||
continue;
|
||||
}
|
||||
tabsToEnd.push(tabs[i]);
|
||||
}
|
||||
return tabsToEnd;
|
||||
|
|
|
@ -29,7 +29,8 @@ add_task(async function withAMultiSelectedTab() {
|
|||
ok(!tab5.multiselected, "Tab5 is not multiselected");
|
||||
is(gBrowser.multiSelectedTabsCount, 2, "Two multiselected tabs");
|
||||
|
||||
let closingTabs = [tab4, tab5];
|
||||
// Tab2 will be closed because tab1 is the contextTab.
|
||||
let closingTabs = [tab2, tab4, tab5];
|
||||
let tabClosingPromises = [];
|
||||
for (let tab of closingTabs) {
|
||||
tabClosingPromises.push(BrowserTestUtils.waitForTabClosing(tab));
|
||||
|
@ -42,7 +43,7 @@ add_task(async function withAMultiSelectedTab() {
|
|||
}
|
||||
|
||||
ok(!tab1.closing, "Tab1 is not closing");
|
||||
ok(!tab2.closing, "Tab2 is not closing");
|
||||
ok(tab2.closing, "Tab2 is closing");
|
||||
ok(!tab3.closing, "Tab3 is not closing");
|
||||
ok(tab4.closing, "Tab4 is closing");
|
||||
ok(tab5.closing, "Tab5 is closing");
|
||||
|
|
Загрузка…
Ссылка в новой задаче