文件chrome.manifest包含: $ b
内容myexample chrome / content / p>
overlay chrome://browser/content/browser.xul chrome://myexample/content/myexample.xul blockquote>
这是非常简约的扩展。
我创建了一个zip文件: $ b
zip -r myexample.xpi myexample /
$ c>工具 - >附加组件 - >从文件安装附件... - >选择myexample.xpi 写道:这个加载项无法安装,因为它似乎已损坏。
我有什么问题?
解决方案<你的问题的标题是误导 - 你的 chrome.manifest 没有任何问题。这个错误消息意味着Firefox无法在您的加载项的顶层找到 install.rdf 文件。如果你运行 unzip -l myexample.xpi ,你会看到如下所示:
长度日期时间名称 -------- ---- ---- ---- myexample / myexample / install.rdf myexample / chrome.manifest myexample / content /正如你所看到的,你压缩的所有文件已被放入 myexample / 子目录中,而不是位于档案的顶层。为了得到正确的结果,你需要运行以下命令:
cd myexample zip -r ../myexample .xpi * cd ..
I'm trying to install my example extension which has the following directory structure.
myexample - install.rdf - chrome.manifest - content -- myexample.js -- myexample.xulThe 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?
解决方案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 ..
更多推荐
安装加载项时出错
发布评论