mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
Support Firefox MV3 (#13191)
* Support Firefox MV3 * Offscreen API's aren't needed for firefox
This commit is contained in:
@@ -63,6 +63,22 @@
|
|||||||
"webRequestAuthProvider",
|
"webRequestAuthProvider",
|
||||||
"notifications"
|
"notifications"
|
||||||
],
|
],
|
||||||
|
"__firefox__permissions": [
|
||||||
|
"activeTab",
|
||||||
|
"alarms",
|
||||||
|
"clipboardRead",
|
||||||
|
"clipboardWrite",
|
||||||
|
"contextMenus",
|
||||||
|
"idle",
|
||||||
|
"scripting",
|
||||||
|
"storage",
|
||||||
|
"tabs",
|
||||||
|
"unlimitedStorage",
|
||||||
|
"webNavigation",
|
||||||
|
"webRequest",
|
||||||
|
"webRequestAuthProvider",
|
||||||
|
"notifications"
|
||||||
|
],
|
||||||
"__safari__permissions": [
|
"__safari__permissions": [
|
||||||
"activeTab",
|
"activeTab",
|
||||||
"alarms",
|
"alarms",
|
||||||
@@ -86,7 +102,7 @@
|
|||||||
"host_permissions": ["https://*/*", "http://*/*"],
|
"host_permissions": ["https://*/*", "http://*/*"],
|
||||||
"content_security_policy": {
|
"content_security_policy": {
|
||||||
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
|
"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": {
|
"sandbox": {
|
||||||
"pages": [
|
"pages": [
|
||||||
|
|||||||
@@ -317,6 +317,8 @@ if (manifestVersion == 2) {
|
|||||||
|
|
||||||
configs.push(mainConfig);
|
configs.push(mainConfig);
|
||||||
} else {
|
} else {
|
||||||
|
// Firefox does not use the offscreen API
|
||||||
|
if (browser !== "firefox") {
|
||||||
// Manifest v3 needs an extra helper for utilities in the content script.
|
// Manifest v3 needs an extra helper for utilities in the content script.
|
||||||
// The javascript output of this should be added to manifest.v3.json
|
// 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["content/misc-utils"] = "./src/autofill/content/misc-utils.ts";
|
||||||
@@ -330,6 +332,9 @@ if (manifestVersion == 2) {
|
|||||||
chunks: ["offscreen-document/offscreen-document"],
|
chunks: ["offscreen-document/offscreen-document"],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const target = browser === "firefox" ? "web" : "webworker";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("webpack").Configuration}
|
* @type {import("webpack").Configuration}
|
||||||
@@ -339,7 +344,7 @@ if (manifestVersion == 2) {
|
|||||||
mode: ENV,
|
mode: ENV,
|
||||||
devtool: false,
|
devtool: false,
|
||||||
entry: "./src/platform/background.ts",
|
entry: "./src/platform/background.ts",
|
||||||
target: "webworker",
|
target: target,
|
||||||
output: {
|
output: {
|
||||||
filename: "background.js",
|
filename: "background.js",
|
||||||
path: path.resolve(__dirname, "build"),
|
path: path.resolve(__dirname, "build"),
|
||||||
|
|||||||
Reference in New Issue
Block a user