fix errors on tabs selection
This commit is contained in:
parent
77cc377803
commit
142c7d45f4
1 changed files with 2 additions and 2 deletions
|
@ -18,12 +18,12 @@ const reopenTab = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectAt = (index) => {
|
const selectAt = (index) => {
|
||||||
return browser.tabs.query({ currentWindow: true }, (tabs) => {
|
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
|
||||||
if (tabs.length < 2) {
|
if (tabs.length < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (index < 0 || tabs.length <= index) {
|
if (index < 0 || tabs.length <= index) {
|
||||||
throw new RangeError(`tab ${index} does not exist`);
|
throw new RangeError(`tab ${index + 1} does not exist`);
|
||||||
}
|
}
|
||||||
let id = tabs[index].id;
|
let id = tabs[index].id;
|
||||||
return browser.tabs.update(id, { active: true });
|
return browser.tabs.update(id, { active: true });
|
||||||
|
|
Reference in a new issue