Fix chrome.runtime.manifest failing when extension is reloaded (#646)

This commit is contained in:
toasted-nutbread 2020-07-01 21:06:25 -04:00 committed by GitHub
parent bc6d855f3d
commit af4dc49074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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') {