(manifest)
| 31 | |
| 32 | // Clones and augments the manifest.json that we use for Chrome with the keys needed for Firefox. |
| 33 | function createFirefoxManifest(manifest) { |
| 34 | manifest = JSON.parse(JSON.stringify(manifest)); // Deep clone. |
| 35 | |
| 36 | manifest.permissions = manifest.permissions |
| 37 | // The favicon permission is not yet supported by Firefox. |
| 38 | .filter((p) => p != "favicon") |
| 39 | // Firefox needs clipboardRead and clipboardWrite for commands like "copyCurrentUrl", but Chrome |
| 40 | // does not. See #4186. |
| 41 | .concat(["clipboardRead", "clipboardWrite"]); |
| 42 | |
| 43 | // As of 2023-07-08 Firefox doesn't yet support background.service_worker. |
| 44 | delete manifest.background["service_worker"]; |
| 45 | Object.assign(manifest.background, { |
| 46 | "scripts": ["background_scripts/main.js"], |
| 47 | }); |
| 48 | |
| 49 | // This key is only supported by Firefox. |
| 50 | Object.assign(manifest.action, { |
| 51 | "default_area": "navbar", |
| 52 | }); |
| 53 | |
| 54 | Object.assign(manifest, { |
| 55 | "browser_specific_settings": { |
| 56 | "gecko": { |
| 57 | // This ID was generated by the Firefox store upon first submission. It's needed in |
| 58 | // development mode, or many extension APIs don't work. |
| 59 | "id": "{d7742d87-e61d-4b78-b8a1-b469842139fa}", |
| 60 | "strict_min_version": "112.0", |
| 61 | "data_collection_permissions": { |
| 62 | "required": ["none"], |
| 63 | }, |
| 64 | }, |
| 65 | }, |
| 66 | }); |
| 67 | |
| 68 | // Firefox supports SVG icons. |
| 69 | Object.assign(manifest, { |
| 70 | "icons": { |
| 71 | "16": "icons/icon.svg", |
| 72 | "32": "icons/icon.svg", |
| 73 | "48": "icons/icon.svg", |
| 74 | "64": "icons/icon.svg", |
| 75 | "96": "icons/icon.svg", |
| 76 | "128": "icons/icon.svg", |
| 77 | }, |
| 78 | }); |
| 79 | |
| 80 | Object.assign(manifest.action, { |
| 81 | "default_icon": "icons/action_disabled.svg", |
| 82 | }); |
| 83 | |
| 84 | return manifest; |
| 85 | } |
| 86 | |
| 87 | async function parseManifestFile() { |
| 88 | // Chrome's manifest.json supports JavaScript comment syntax. However, the Chrome Store rejects |
no test coverage detected