aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-07-01 21:06:25 -0400
committerGitHub <noreply@github.com>2020-07-01 21:06:25 -0400
commitaf4dc49074eb0431090b10ab0e8d7bdd8c605963 (patch)
tree49f20795092a640195724ae459bc094e7846a973 /ext
parentbc6d855f3dd7a8ac198593c15a25dca53a89a18f (diff)
Fix chrome.runtime.manifest failing when extension is reloaded (#646)
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/js/yomichan.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/mixed/js/yomichan.js b/ext/mixed/js/yomichan.js
index ab1afcd9..00335eba 100644
--- a/ext/mixed/js/yomichan.js
+++ b/ext/mixed/js/yomichan.js
@@ -39,6 +39,14 @@ const yomichan = (() => {
constructor() {
super();
+ this._extensionName = 'Yomichan';
+ try {
+ const manifest = chrome.runtime.getManifest();
+ this._extensionName = `${manifest.name} v${manifest.version}`;
+ } catch (e) {
+ // NOP
+ }
+
const {promise, resolve} = deferPromise();
this._isBackendPreparedPromise = promise;
this._isBackendPreparedPromiseResolve = resolve;
@@ -163,8 +171,7 @@ const yomichan = (() => {
errorString += `\n${errorStack}`;
}
- const manifest = chrome.runtime.getManifest();
- let message = `${manifest.name} v${manifest.version} has encountered a problem.`;
+ let message = `${this._extensionName} has encountered a problem.`;
message += `\nOriginating URL: ${context.url}\n`;
message += errorString;
if (typeof errorData !== 'undefined') {