From 8f48d40f7cffc8a0c6f0401dbfc1f3b0422ec21b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 31 Jan 2024 08:21:44 -0500 Subject: Fix chrome.runtime.lastError not working properly on Firefox (#593) --- ext/js/extension/web-extension.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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'); } -- cgit v1.2.3