Search code examples
firefoxfirefox-addonfirefox-addon-webextensionschrome-extension-manifest-v3

Export Chrome MV3 extension to Firefox MV3


I've created a test extension using manifest V3 that works in chrome

manifest.json:

{
  "manifest_version": 3,
  "name": "test",
  "version": "0.0.1",
  "content_scripts": [
    {
      "matches": ["*://*/*"],
      "js": ["content.js"]
    }
  ]
}

content.js:

alert('test')

I tried running

web-ext run --firefox-preview

A browser window opens, but the extension is not working... Using the --verbose option I find these errors

 Firefox stderr: [Parent 14212, IPC I/O Parent] WARNING: file /builds/worker/checkouts/gecko/ipc/chromium/src/base/process_util_win.cc:167
 Firefox stderr: JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory.
 Firefox stdout: console.error: services.settings:
 Firefox stdout: main/whats-new-panel Signature failed  InvalidSignatureError: Invalid content signature (main/whats-new-panel)
 Firefox stdout: console.error: services.settings:
 Firefox stdout: main/whats-new-panel local data was corrupted
console.warn: services.settings: main/whats-new-panel Signature verified failed. Retry from scratch
 Firefox stdout: console.error: services.settings:
 Firefox stdout: main/addons-manager-settings Signature failed again InvalidSignatureError: Invalid content signature (main/addons-manager-settings)
 Firefox stdout: console.error: services.settings:
 Firefox stdout: Message: InvalidSignatureError: Invalid content signature (main/addons-manager-settings)
  Stack:
    InvalidSignatureError@resource://services-settings/RemoteSettingsClient.jsm:169:5
_validateCollectionSignature@resource://services-settings/RemoteSettingsClient.jsm:977:13

Solution

  • As it's stated in this article,
    "The issue is about host permissions, in MV3, they’re not granted automatically on install, but instead user needs to grant them at some point. Depending on what’s appropriate for your extension, you could ask the user using promise.request() , or they can grant it by going to about:addons, selecting your addon, and flipping the toggle in the permissions tab."