Error when installing add-on

ε祈祈猫儿з 提交于 2020-03-26 16:40:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!