Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Fix #406, prefer the active tab when a service matches several tabs #416

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions extension/background/serviceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,16 @@ this.serviceList = (function() {
}),
};
}
let best = 0;
for (let i = 0; i < tabs.length; i++) {
if (tabs[i].active) {
best = i;
}
}
if (activate) {
await browser.tabs.update(tabs[0].id, { active: activate });
await browser.tabs.update(tabs[best].id, { active: activate });
}
return { created: false, tab: tabs[0] };
return { created: false, tab: tabs[best] };
}

async getAllTabs(extraQuery) {
Expand Down