安装加载项时出错

时间:2011-11-21 09:13:00

标签: firefox-addon manifest

我正在尝试安装具有以下目录结构的示例扩展。

myexample
- install.rdf
- chrome.manifest
- content
-- myexample.js
-- myexample.xul

chrome.manifest文件包含:

  

内容myexample chrome / content /

     

overlay chrome://browser/content/browser.xul   铬://myexample/content/myexample.xul

这是极简主义的扩展。

我从中创建了一个zip文件:

zip -r myexample.xpi myexample/

在Firefox Tools -> Add-ons -> Install Add-on from file ... -> choose myexample.xpi中安装时,它写道:

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

我有什么问题吗?

1 个答案:

答案 0 :(得分:6)

您的问题标题具有误导性 - 您的chrome.manifest没有任何问题。此错误消息意味着Firefox无法在加载项的顶级找到install.rdf文件。如果您运行unzip -l myexample.xpi,您会看到如下内容:

  Length     Date   Time    Name
 --------    ----   ----    ----
                            myexample/
                            myexample/install.rdf
                            myexample/chrome.manifest
                            myexample/content/

如您所见,您压缩的所有文件都已放入myexample/子目录,而不是存档的顶层。要获得正确的结果,您需要运行以下命令:

cd myexample
zip -r ../myexample.xpi *
cd ..