зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1486050 - Don't change selected tab when browser.tabs.update is called with {highlighted: true, active: false}. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D4272 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cbab098175
Коммит
f81e9b49d1
|
@ -712,9 +712,12 @@ this.tabs = class extends ExtensionAPI {
|
||||||
if (updateProperties.highlighted) {
|
if (updateProperties.highlighted) {
|
||||||
if (!nativeTab.selected && !nativeTab.multiselected) {
|
if (!nativeTab.selected && !nativeTab.multiselected) {
|
||||||
tabbrowser.addToMultiSelectedTabs(nativeTab, false);
|
tabbrowser.addToMultiSelectedTabs(nativeTab, false);
|
||||||
// Select the highlighted tab, this matches Chrome's behavior.
|
// Select the highlighted tab unless active:false is provided.
|
||||||
tabbrowser.lockClearMultiSelectionOnce();
|
// Note that Chrome selects it even in that case.
|
||||||
tabbrowser.selectedTab = nativeTab;
|
if (updateProperties.active !== false) {
|
||||||
|
tabbrowser.lockClearMultiSelectionOnce();
|
||||||
|
tabbrowser.selectedTab = nativeTab;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tabbrowser.removeFromMultiSelectedTabs(nativeTab, true);
|
tabbrowser.removeFromMultiSelectedTabs(nativeTab, true);
|
||||||
|
|
|
@ -115,25 +115,24 @@ add_task(async function test_update_highlighted() {
|
||||||
|
|
||||||
await expectResults(async () => {
|
await expectResults(async () => {
|
||||||
await browser.tabs.update(tab2, {highlighted: true, active: false});
|
await browser.tabs.update(tab2, {highlighted: true, active: false});
|
||||||
return {active: tab2, highlighted: [tab1, tab2], events: [
|
return {active: tab1, highlighted: [tab1, tab2], events: [
|
||||||
["onActivated", {tabId: tab2, windowId}],
|
|
||||||
["onHighlighted", {tabIds: [tab1, tab2], windowId}],
|
["onHighlighted", {tabIds: [tab1, tab2], windowId}],
|
||||||
]};
|
]};
|
||||||
}, "highlighting and (not really) inactivating non-highlighted tab");
|
}, "highlighting without activating non-highlighted tab");
|
||||||
|
|
||||||
await expectResults(async () => {
|
await expectResults(async () => {
|
||||||
await browser.tabs.update(tab1, {highlighted: true, active: true});
|
await browser.tabs.update(tab2, {highlighted: true, active: true});
|
||||||
return {active: tab1, highlighted: [tab1], events: [
|
return {active: tab2, highlighted: [tab2], events: [
|
||||||
["onActivated", {tabId: tab1, windowId}],
|
["onActivated", {tabId: tab2, windowId}],
|
||||||
["onHighlighted", {tabIds: [tab1], windowId}],
|
["onHighlighted", {tabIds: [tab2], windowId}],
|
||||||
]};
|
]};
|
||||||
}, "highlighting and activating inactive highlighted tab");
|
}, "highlighting and activating inactive highlighted tab");
|
||||||
|
|
||||||
await expectResults(async () => {
|
await expectResults(async () => {
|
||||||
await browser.tabs.update(tab2, {active: true, highlighted: true});
|
await browser.tabs.update(tab1, {active: true, highlighted: true});
|
||||||
return {active: tab2, highlighted: [tab2], events: [
|
return {active: tab1, highlighted: [tab1], events: [
|
||||||
["onActivated", {tabId: tab2, windowId}],
|
["onActivated", {tabId: tab1, windowId}],
|
||||||
["onHighlighted", {tabIds: [tab2], windowId}],
|
["onHighlighted", {tabIds: [tab1], windowId}],
|
||||||
]};
|
]};
|
||||||
}, "highlighting and activating non-highlighted tab");
|
}, "highlighting and activating non-highlighted tab");
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче