From 6a56bf31d3c11b261a32ac9dce77aeaf351c31f5 Mon Sep 17 00:00:00 2001 From: Mircea Hasegan Date: Wed, 19 Feb 2025 12:10:32 +0100 Subject: [PATCH] refactor(extension): load bg/sw script exclusively based on browser target Although manifest accepts both at the same time, a warning is displayed in the extension logs, which can be avoided by using only the relevant one based on browser type --- apps/browser-extension-wallet/manifest.json | 3 +-- apps/browser-extension-wallet/webpack-utils.js | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/browser-extension-wallet/manifest.json b/apps/browser-extension-wallet/manifest.json index c700f6908c..17eee6e433 100644 --- a/apps/browser-extension-wallet/manifest.json +++ b/apps/browser-extension-wallet/manifest.json @@ -10,8 +10,7 @@ "128": "icon128.png" }, "background": { - "service_worker": "./js/background.js", - "scripts": ["./js/background.js"] + "service_worker": "./js/background.js" }, "action": { "default_popup": "popup.html" diff --git a/apps/browser-extension-wallet/webpack-utils.js b/apps/browser-extension-wallet/webpack-utils.js index 4e92891b42..a6ad40eeca 100644 --- a/apps/browser-extension-wallet/webpack-utils.js +++ b/apps/browser-extension-wallet/webpack-utils.js @@ -68,7 +68,10 @@ const transformManifest = (content, mode) => { } }; } + // Firefox: Reading text is only available for extensions with the Web Extension clipboardRead permission manifest.permissions = [...manifest.permissions, 'clipboardRead']; + // The background script in Firefox is a hidden DOM page + manifest.background = { scripts: ['./js/background.js'] }; } else if (process.env.BROWSER === 'chrome') { manifest.key = process.env.LACE_EXTENSION_KEY; }