"Add-On Appears To Be Corrupt" Nonsense

So, I’m developing a (currently unpublished) extension. I really want to be able to use it on the daily, to be my own quality assurance. Unfortunately every time I’ve tried to install my add-on, it errors with “This add-on could not be installed because it appears to be corrupt”. I’ve gone down the rabbit hole, done everything I can, all to no avail.

This is everything I’ve done and am sure of:

  • I’m using Firefox Developer, 94.0b5 (64-bit)
    • On Arch Linux 5.14.9-arch2-1
  • xpinstall.signatures.required is set to false in the about:config
    • In Firefox Developer, yes, I’ve checked
    • I’ve also set xpinstall.whitelist.required to false
  • I am zipping my extension in a compatible way
    • I’m using no compression, with the command zip -0r ./extension.xpi ./extension
  • My manifest.json has no errors
    • It only contains the mandatory keys, manifest_version, name, version, and has browser_specific_settings set
      • manifest_version is 2
      • name consists only of ASCII characters A-Z, a-z and space
      • version is "0.1"
      • browser_specific_settings is an object with one key, gecko, which is an object with one key, id, set to "extension@danii.dev"
    • I have confirmed it is valid JSON by using this command in a Node REPL: require("fs").readFile("manifest.json", (_, file) => console.log(JSON.parse(file.toString())));
  • Installing it as just a folder doesn’t work
    • It manages to parse the manifest and show a prompt with an Add button
      • Clicking Add errors with Extension could not be installed because Firefox Developer Edition cannot modify the needed file.
        • This isn’t a problem with my drive, it’s just that the add-on installation code doesn’t know how to read an extension from a folder but the verification code can -.-
          • I know this because in the browser console the exact error is Unix error 21 during operation read on file (folder path) (Is a directory)
  • This error drives me crazy

Is this a bug? Or am I extremely ignorant?

Assuming signatures are not required, the error message you’re getting implies that there might be some stray files in your .xpi archive. The expected result is this sequence:

If you want to test that file, it’s the attached one, but I renamed it to .xpi before installing from the Add-ons page menu, “Install Add-on From File”.

copy-frame-url_v1.2.zip (9.1 KB)

Hi, I’ve removed all stray files from my Add-On, and it still doesn’t work. Although I’ve managed to conclude that it must be something wrong with my zip command, as I’ve rezipped your extension, and after doing so it miraculously was corrupted. I’m zipping with no compression which according to the documentation should be fine? I’ve also tried compressing with the deflate method, and it still doesn’t work.

I’m not familiar with the details of the ZIP protocol. If you extract from my file and from your file, do you get the identical results (i.e., same folders and hierarchy)?