首页 文章

Firefox插件兼容性错误

提问于
浏览
1

我正在尝试为Firefox构建一个简单的XUL插件 . 我不使用任何工具来构建它 . 构建过程如下:将项目文件压缩为.zip,然后将.zip重命名为.xpi文件,转到Firefox插件管理器并使用“从文件安装附加组件...”然后我得到了错误“无法安装加载项,因为它与Firefox 33.1.1不兼容” . 这是我的install.rdf文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" mlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>addon@addon.com</em:id>
<em:type>2</em:type>
<em:name>addon</em:name>
<em:version>1.0</em:version>
<em:creator>SC</em:creator>
<em:description>addon description</em:description>
<em:homepageURL>http://www.example.com/</em:homepageURL>
<em:iconURL>chrome://addon/skin/icon.png</em:iconURL>
<em:optionsURL>chrome://addon/content/options.xul</em:optionsURL>
<em:targetApplication>
  <Description>
    <em:id>{ec8030f7-c20a-464f-9b0e-13a3bbe97384}</em:id> <!-- Firefox -->
    <em:minVersion>29.*</em:minVersion>
    <em:maxVersion>36.*</em:maxVersion>
  </Description>
</em:targetApplication>
</Description>
</RDF>

我尝试了各种最小和最大版本但我得到了同样的错误 . 我觉得问题出在其他地方,而不是来自此文件的minVersion和maxVersion . 还有什么地方可能是问题?

1 回答

  • 3

    您正在使用的GUID, <em:id> 对于Firefox不正确 . 对于桌面Firefox,您应该使用:

    <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
    

    区别在于最后一节 .
    不正确:
    13a3bbe97384
    正确:
    13a3a9e97384

    您可以在Mozilla Valid Application Versions页面上找到有效GUID和版本的列表 .

    虽然它不会导致您的错误,但您可能不想使用:
    <em:minVersion>29.*</em:minVersion>
    不应在 <em:minVersion> 字段中使用通配符 . 通配符将默认为最高版本 . 对于您可能想要的 - 所有29或更高版本 - 您应该使用:
    <em:minVersion>29.0</em:minVersion>

    具体来说,请参见Choosing minVersion and maxVersion

    不要错误地认为版本中的*代表任何版本 . *实际上代表了一个无限高的数字,因此实际上只在maxVersion中使用 . 在minVersion中使用它通常不会产生你想要的效果 .

相关问题