2014-11-21 96 views
1

我正在嘗試爲Firefox構建一個簡單的XUL插件。我不使用任何工具來構建它。構建過程如下:將項目文件壓縮爲.zip文件,然後將.zip文件重命名爲.xpi文件,轉至Firefox插件管理器並使用「從文件安裝附加組件」,然後獲取錯誤「附件無法安裝,因爲它與Firefox 33.1.1不兼容」。 這是我的install.rdf文件內容:Firefox插件兼容性錯誤

<?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>[email protected]</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。 還有什麼地方可以解決問題?

回答

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中使用它通常不會產生您想要的效果。

+0

哇,非常注意你! – Noitidart 2014-11-21 15:47:19