本文介绍了安装加载项时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  myexample 
- 安装我的示例扩展,它具有以下目录结构.rdf
- chrome.manifest
- content
- myexample.js
- myexample.xul

文件chrome.manifest包含:
$ b

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 ..

这篇关于安装加载项时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:02