Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add-on "appears to be corrupt" when trying to install my add-on's .xpi file in Firefox

Tags:

I am trying to install an extension in Firefox 45 (same happens with Firefox 49), but Firefox does not allow me to do that, indicating that

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

The way I am trying to install it is simply by dragging the .xpi file our team developed, into the Firefox window. This extension is based on MozRepl, but with some improvements.

Previously, I tried to install it but I couldn't as it was not signed (extensions in Firefox versions from 43 onwards require signing). I followed every step in order to sign it, according to this post: Signing a XPI. I am almost certain I could sign it correctly, but now the error Firefox displays is different: "This add-on could not be installed because it appears to be corrupt."

enter image description here

It seems that I am not creating the .xpi file correctly, but I am not sure which is the correct structure it should have. I tried different folder structures, but with no success.

Also, I checked the Browser Console to see what error is logged in, but I didn't found it really helpful. Here it is:

enter image description here

Here is a link to the .xpi file in case you want to check its content. Note that I tried moving the files manifest.mf, zigbert.rsa and zigbert.sf outside the META-INF folder, but it didn't work either.

Has anyone stumbled across an error like this when trying to install an add-on? Any ideas of what maybe happening?

like image 953
ndarriulat Avatar asked Oct 04 '16 13:10

ndarriulat


People also ask

How do I install an XPI file in Firefox?

How do I install an XPI file in the mobile version of Firefox? On Android devices, you can install the add-on an XPI file contains by locating the file in an Android file manager (such as File Viewer Plus or ES File Explorer), tapping it, and opening it with Firefox.

What is a .XPI file?

A XPI (pronounced "zippy" and derived from XPInstall) installer module is a ZIP file that contains an install script or a manifest at the root of the file, and a number of data files. In Mozilla, Firefox before 0.7, and before 0.5, the package contained a JavaScript install script (install.


1 Answers

The .xpi file must use only "deflate" compression or uncompressed

The zip implementation within Firefox only supports uncompressed files or files compressed with the "Deflate" algorithm. You will need to create the .zip archive using the compression method "Deflate" instead of the "LZMA" which you are currently using. How to do so will depend on the tools you use to create your archive.

Personally, I use a batch file/shell script to create the .xpi file as I describe in detail in my answer to "Firefox extension .xpi file structure: description, contents, creation, and installation". The basics are that I use the zip command line tool which defaults to "deflate" or uncompressed. I use the -1 option to provide the fastest compression. Firefox/Mozilla use .xpi files both to package the files, but to also increase file access speed. The important quality is not a high compression ratio, but that the files can be accessed quickly. Unless Firefox is not an WebExtension and explicitly told to unpack the add-on by the install.rdf option <em:unpack>true</em:unpack> (WebExtensions don't have install.rdf files), the add-on will be installed as the .xpi file and all access to the add-on will be as the .xpi file.

Note: Given that your extension contains .dll files, you may need to have your add-on installed unpacked by using <em:unpack>true</em:unpack>.

Wrong signing method used. It must be signed by Mozilla, not yourself.

While it is not the error you are currently seeing, as soon as you fix the problem with your .xpi format, you will encounter an issue with your extension being signed by the wrong signature. You signed your extension with your own signature. It was not signed by Mozilla. This will not work. It must be signed by Mozilla, not yourself.You mentioned that you followed the directions in the MDN page Signing an XPI. However, as is clearly stated at the top of that page, the directions on that page are outdated and no longer work. You should have followed the link in the note to the page Signing and distributing your add-on. The note at the top of the page states:

Note: These instructions are outdated. For an extension to work in Firefox it must be signed by Mozilla, not by yourself. See Signing and distributing your add-on. [Emphasis added]

There are also a variety of questions here on Stack Overflow which address the signing issue.

like image 180
Makyen Avatar answered Sep 24 '22 00:09

Makyen