summaryrefslogtreecommitdiff
path: root/ext/bg/js/api.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-20 10:58:22 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-20 10:58:22 -0400
commit362a1ed9e4621c47b4dca99777015b90fc90451c (patch)
tree4b48a211588984a682b0bd78e7df60c304d6b04f /ext/bg/js/api.js
parentd7dc8ac9cddc95971f542c8e0b98e16f1f00645e (diff)
Catch exception thrown on Edge
Diffstat (limited to 'ext/bg/js/api.js')
-rw-r--r--ext/bg/js/api.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 94a53e67..93d9c155 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -380,20 +380,24 @@ async function apiFocusTab(tab) {
return;
}
- const tabWindow = await new Promise((resolve) => {
- chrome.windows.get(tab.windowId, {}, (tabWindow) => {
- const e = chrome.runtime.lastError;
- if (e) { reject(e); }
- else { resolve(tabWindow); }
- });
- });
- if (!tabWindow.focused) {
- await new Promise((resolve, reject) => {
- chrome.windows.update(tab.windowId, {focused: true}, () => {
+ try {
+ const tabWindow = await new Promise((resolve) => {
+ chrome.windows.get(tab.windowId, {}, (tabWindow) => {
const e = chrome.runtime.lastError;
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.
}
}