Catch exception thrown on Edge
This commit is contained in:
parent
d7dc8ac9cd
commit
362a1ed9e4
@ -380,20 +380,24 @@ async function apiFocusTab(tab) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabWindow = await new Promise((resolve) => {
|
try {
|
||||||
chrome.windows.get(tab.windowId, {}, (tabWindow) => {
|
const tabWindow = await new Promise((resolve) => {
|
||||||
const e = chrome.runtime.lastError;
|
chrome.windows.get(tab.windowId, {}, (tabWindow) => {
|
||||||
if (e) { reject(e); }
|
|
||||||
else { resolve(tabWindow); }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!tabWindow.focused) {
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
chrome.windows.update(tab.windowId, {focused: true}, () => {
|
|
||||||
const e = chrome.runtime.lastError;
|
const e = chrome.runtime.lastError;
|
||||||
if (e) { reject(e); }
|
if (e) { reject(e); }
|
||||||
else { resolve(); }
|
else { resolve(tabWindow); }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
if (!tabWindow.focused) {
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
chrome.windows.update(tab.windowId, {focused: true}, () => {
|
||||||
|
const e = chrome.runtime.lastError;
|
||||||
|
if (e) { reject(e); }
|
||||||
|
else { resolve(); }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Edge throws exception for no reason here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user