Firefox扩展自动更新无法正常工作

时间:2013-05-14 09:50:22

标签: firefox firefox-addon automatic-updates

我按照说明here安装后我打开了控制台模式进行调试但是日志卡在那里没有任何响应: 控制台只显示如下内容,而不是输出:

*** LOG addons.updates: Requesting https://www.extension.host.com/update.rdf

我的install.rdf是:

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">

    <em:id>webmailchecker@mozilla.doslash.org</em:id>
    <em:name>WebMail Checker for Firefox</em:name>
    <em:version>1.0</em:version>
    <em:description>WebMail Checker</em:description>
    <em:updateURL>https://www.extension.host.com/update.rdf</em:updateURL>

    <!-- Firefox -->
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>3.6</em:minVersion>
        <em:maxVersion>23.*</em:maxVersion>
      </Description>
    </em:targetApplication>
  </Description>
</RDF>

update.rdf是:

<?xml version="1.0" encoding="UTF-8"?>

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <RDF:Description about="urn:mozilla:extension:webmailchecker@mozilla.doslash.org">
    <em:updates>
      <RDF:Seq>

        <!-- Each li is a different version of the same add-on -->
        <RDF:li>
          <RDF:Description>
            <em:version>1.0</em:version> 
            <em:targetApplication>
              <RDF:Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>23.*</em:maxVersion>
                <em:updateLink>https://www.extension.host.com/firefox.xpi</em:updateLink>

              </RDF:Description>
            </em:targetApplication>
          </RDF:Description>
        </RDF:li>

        <RDF:li>
          <RDF:Description>
            <em:version>2.0</em:version>
            <em:targetApplication>
              <RDF:Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>23.*</em:maxVersion>
                <em:updateLink>https://www.extension.host.com/firefox_2.0.xpi</em:updateLink>
              </RDF:Description>
            </em:targetApplication>
          </RDF:Description>
        </RDF:li>

      </RDF:Seq>
    </em:updates>
  </RDF:Description>
</RDF:RDF>

在服务器端,update.rdf和xpi文件都返回为javax.ws.rs.core.Response,我已在web.xml中配置了mimemapping,如下所示:

<mime-mapping>
    <extension>xpi</extension>
    <mime-type>application/x-xpinstall</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>rdf</extension>
    <mime-type>text/xml</mime-type>
</mime-mapping>

我错过了什么?自动更新无效。

1 个答案:

答案 0 :(得分:6)

今天我再次回顾这个问题,最后解决了这个问题。我会更新答案以防其他人需要这个。 我查看了源代码AddonUpdateChecker.jsm,我之前应该这样做。 我使用javascript调试器来调试更新。在此之前,我真的没有看到任何日志表明我应该有builtInCertificate。 并发现它正在调查有关证书的pref值。 哪些是 extensions.install.requireBuiltInCerts extensions.update.requireBuiltInCerts

将这两个prefs值设置为false,udpate可以正常工作。

其他具有不同ssl证书的人可能不会遇到这个问题。