5

I created a simple Firefox extension (using WebExtensions) that I want to use every day in Firefox without publishing it on addons.mozilla.org (AMO). I was able to install it temporarily and verify that it works by going to about:debugging, clicking on the "Load Temporary Add-On" button, and opening the manifest.json file.

Since I want to use the extension without having to go through that process every time I restart Firefox, I packaged it into an XPI file and tried installing it like a regular local extension. I archived the two files (manifest.json, content_script.js) and the one directory (icons/) into a ZIP file and renamed it to test.xpi. At about:addons, I clicked the gear icon, selected "Install Add-on From File", and selected the test.xpi file. But Firefox always gave me the error

"This add-on could not be installed because it appears to be corrupt".

In creating the ZIP file, I was careful to keep the manifest file at the top of the archive, and did not include the containing folder itself. I tried following some detailed instructions on installing an XPI file locally, and even installed Cygwin in order to get access to the "zip" utility that the instructions mention, but I'm not able to find that utility in any of the Cygwin folders.

To see if the problem was a lack of a Mozilla signature, I submitted it to AMO (addons.mozilla.org) for signing. AMO signed it and provided me with a new XPI file, which I assumed to be installable since it was signed. But this officially created and signed XPI file still got the error that it was corrupt.

Does anyone have ideas as to how I can figure out what's causing this?

avidcoder
  • 123
  • 1
  • 9
  • Without access to the actual *.xpi* file, there's no way for us to do anything other than guess at what the problem might be. – Makyen Sep 22 '17 at 01:57
  • You might want to look at my answer to: [How can I disable signature checking for Firefox add-ons?](https://stackoverflow.com/a/42403531), which may help with using alternative methods. – Makyen Sep 22 '17 at 01:59
  • You should also look through [these posts](https://stackoverflow.com/search?q=%5Bfirefox-addon%5D+appears+to+be+corrupt) – Makyen Sep 22 '17 at 02:00

1 Answers1

4

I was able to solve this: It turns out that the manifest requires an "id" property, even though the Mozilla documentation claims otherwise: "However, from Firefox 48 you can develop, debug, publish, and update extensions without needing to set an explicit ID at all." and "When do you need an add-on ID? If you are loading the add-on from it's [sic] XPI file, are not loading it temporarily using about:debugging and it is not signed [my XPI file was signed]".

avidcoder
  • 123
  • 1
  • 9
  • I found an example of how to add this here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/applications . Somthing like the following json has to be added to the top level of the manifest.json file: "applications": { "gecko": { "id": "addon@example.com", "strict_min_version": "42.0" } } – BenjaminJackman Nov 27 '17 at 01:46
  • Thanks for the solution! FWIW, the Addon server team looks no less surprised at the `id` invasiveness: https://github.com/mozilla/addons-server/issues/8587#issuecomment-418742520 (this comment and a few following it). – kkm inactive - support strike Dec 17 '18 at 06:01
  • wow, this is still not fixed... – xeruf Jun 05 '22 at 21:06