问题
I'm trying to install my example extension which has the following directory structure.
myexample
- install.rdf
- chrome.manifest
- content
-- myexample.js
-- myexample.xul
The file chrome.manifest contains:
content myexample chrome/content/
overlay chrome://browser/content/browser.xul chrome://myexample/content/myexample.xul
It's pretty minimalist extension.
I created a zip file from it:
zip -r myexample.xpi myexample/
When installing it in Firefox Tools -> Add-ons -> Install Add-on from file ... -> choose myexample.xpi
it writes:
This add-on could not be installed because it appears to be corrupt.
Did I something wrong?
回答1:
The title of your question is misleading - there is nothing wrong with your chrome.manifest
. This error message rather means that Firefox couldn't find install.rdf
file at the top level of your add-on. If you run unzip -l myexample.xpi
you will see something like this:
Length Date Time Name
-------- ---- ---- ----
myexample/
myexample/install.rdf
myexample/chrome.manifest
myexample/content/
As you see, all files you zipped have been put into the myexample/
subdirectory instead of being at the top level of the archive. To get the correct result you need to run the following commands:
cd myexample
zip -r ../myexample.xpi *
cd ..
来源:https://stackoverflow.com/questions/8209508/error-when-installing-add-on