1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-15 01:11:47 +01:00

Support Firefox MV3 (#13191)

* Support Firefox MV3

* Offscreen API's aren't needed for firefox
This commit is contained in:
Justin Baur 2025-02-11 10:22:54 -05:00 committed by GitHub
parent ddd91856ff
commit a03837120d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 14 deletions

View File

@ -63,6 +63,22 @@
"webRequestAuthProvider",
"notifications"
],
"__firefox__permissions": [
"activeTab",
"alarms",
"clipboardRead",
"clipboardWrite",
"contextMenus",
"idle",
"scripting",
"storage",
"tabs",
"unlimitedStorage",
"webNavigation",
"webRequest",
"webRequestAuthProvider",
"notifications"
],
"__safari__permissions": [
"activeTab",
"alarms",
@ -86,7 +102,7 @@
"host_permissions": ["https://*/*", "http://*/*"],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
"sandbox": "sandbox allow-scripts; script-src 'self'"
"__chrome__sandbox": "sandbox allow-scripts; script-src 'self'"
},
"sandbox": {
"pages": [

View File

@ -317,19 +317,24 @@ if (manifestVersion == 2) {
configs.push(mainConfig);
} else {
// Manifest v3 needs an extra helper for utilities in the content script.
// The javascript output of this should be added to manifest.v3.json
mainConfig.entry["content/misc-utils"] = "./src/autofill/content/misc-utils.ts";
mainConfig.entry["offscreen-document/offscreen-document"] =
"./src/platform/offscreen-document/offscreen-document.ts";
// Firefox does not use the offscreen API
if (browser !== "firefox") {
// Manifest v3 needs an extra helper for utilities in the content script.
// The javascript output of this should be added to manifest.v3.json
mainConfig.entry["content/misc-utils"] = "./src/autofill/content/misc-utils.ts";
mainConfig.entry["offscreen-document/offscreen-document"] =
"./src/platform/offscreen-document/offscreen-document.ts";
mainConfig.plugins.push(
new HtmlWebpackPlugin({
template: "./src/platform/offscreen-document/index.html",
filename: "offscreen-document/index.html",
chunks: ["offscreen-document/offscreen-document"],
}),
);
mainConfig.plugins.push(
new HtmlWebpackPlugin({
template: "./src/platform/offscreen-document/index.html",
filename: "offscreen-document/index.html",
chunks: ["offscreen-document/offscreen-document"],
}),
);
}
const target = browser === "firefox" ? "web" : "webworker";
/**
* @type {import("webpack").Configuration}
@ -339,7 +344,7 @@ if (manifestVersion == 2) {
mode: ENV,
devtool: false,
entry: "./src/platform/background.ts",
target: "webworker",
target: target,
output: {
filename: "background.js",
path: path.resolve(__dirname, "build"),