安装附加组件时出错
我正在尝试安装具有以下目录结构的示例扩展。
myexample
- install.rdf
- chrome.manifest
- content
-- myexample.js
-- myexample.xul
文件 chrome.manifest 包含:
内容 myexample chrome/content/
覆盖 chrome://browser/content/browser.xul chrome://myexample/content/myexample.xul
这是非常简约的扩展。
我从中创建了一个 zip 文件:
zip -r myexample.xpi myexample/
在 Firefox 中安装时 Tools ->;附加组件 ->从文件安装附加组件... ->选择 myexample.xpi
它写道:
无法安装此附加组件,因为它似乎已损坏。
我有什么问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题标题具有误导性 - 您的
chrome.manifest
没有任何问题。此错误消息意味着 Firefox 在您的附加组件的顶层找不到install.rdf
文件。如果您运行unzip -l myexample.xpi
您将看到如下内容:如您所见,您压缩的所有文件都已放入
myexample/
子目录中,而不是位于档案的顶层。要获得正确的结果,您需要运行以下命令:The title of your question is misleading - there is nothing wrong with your
chrome.manifest
. This error message rather means that Firefox couldn't findinstall.rdf
file at the top level of your add-on. If you rununzip -l myexample.xpi
you will see something like this: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: