aboutsummaryrefslogtreecommitdiff
path: root/ext/js/extension/web-extension.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-01-31 08:21:44 -0500
committerGitHub <noreply@github.com>2024-01-31 13:21:44 +0000
commit8f48d40f7cffc8a0c6f0401dbfc1f3b0422ec21b (patch)
treebb629051921b72de5a7ae3ba4b22ace1f03d6eef /ext/js/extension/web-extension.js
parent38235b98494a1148391adf240206b0d5a3727be1 (diff)
Fix chrome.runtime.lastError not working properly on Firefox (#593)
Diffstat (limited to 'ext/js/extension/web-extension.js')
-rw-r--r--ext/js/extension/web-extension.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/js/extension/web-extension.js b/ext/js/extension/web-extension.js
index 95a61339..2aafbe92 100644
--- a/ext/js/extension/web-extension.js
+++ b/ext/js/extension/web-extension.js
@@ -91,7 +91,8 @@ export class WebExtension extends EventDispatcher {
*/
getLastError() {
const {lastError} = chrome.runtime;
- if (typeof lastError !== 'undefined') {
+ if (lastError) {
+ if (lastError instanceof Error) { return lastError; }
const {message} = lastError;
return new Error(typeof message === 'string' ? message : 'An unknown web extension error occured');
}