aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/yomitan.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/js/yomitan.js b/ext/js/yomitan.js
index 2fbe99cc..7505c0ca 100644
--- a/ext/js/yomitan.js
+++ b/ext/js/yomitan.js
@@ -21,8 +21,10 @@ import {CrossFrameAPI} from './comm/cross-frame-api.js';
import {EventDispatcher, deferPromise, invokeMessageHandler, log} from './core.js';
import {ExtensionError} from './core/extension-error.js';
-// Set up chrome alias if it's not available (Edge Legacy)
-if ((() => {
+/**
+ * @returns {boolean}
+ */
+function checkChromeNotAvailable() {
let hasChrome = false;
let hasBrowser = false;
try {
@@ -36,7 +38,10 @@ if ((() => {
// NOP
}
return (hasBrowser && !hasChrome);
-})()) {
+}
+
+// Set up chrome alias if it's not available (Edge Legacy)
+if (checkChromeNotAvailable()) {
// @ts-expect-error - objects should have roughly the same interface
// eslint-disable-next-line no-global-assign
chrome = browser;