目录
如果存在 install.rdf,为什么附加图标会消失?
firefox-addon
浏览量:14
编辑于:2023-04-12 21:33:58

安装附加组件后,我在 Firefox 中看不到工具栏图标。 我在开发过程中遇到了这个问题。如果存在install.rdf文件,则附加组件的图标不会出现在 Firefox 工具栏中。但是,在没有文件的情况下,它绝对可以正常工作。怎么了?install.rdf

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

<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>extensionName@myDomain.com</em:id>
    <em:version>1.23</em:version>
    <em:type>2</em:type>

    <em:targetApplication>
      <Description>
        <em:id>{uuid here}</em:id>
        <em:minVersion>31.*</em:minVersion>
        <em:maxVersion>47.*</em:maxVersion>
      </Description>
    </em:targetApplication>

    <em:name>extensionName</em:name>
    <em:description>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam voluptates natus soluta quis culpa animi, vitae laborum magnam! Facere reiciendis nihil porro non odio hic deserunt obcaecati soluta, nostrum recusandae!</em:description>
    <em:creator>Name LastName</em:creator>
    <em:homepageURL>http://www.mydDomain.com/</em:homepageURL>
  </Description>
</RDF>
解决方案:

此答案基于有关附加组件的一些假设。在问题中包含最小、完整和可验证的示例 (MCVE) 对您很有帮助,这样我们就可以复制问题。如果没有MCVE,有必要猜测您的问题到底是什么。

您的扩展在没有文件的情况下“工作”(或至少在 Firefox 工具栏中显示一个图标)这一事实意味着您正在使用附加 SDK。此答案基于您正在使用附加 SDK 的假设。如果您没有使用附加 SDK,那么如果没有 anfile,附加组件应该根本无法工作,我们需要一个MCVE。附加 SDK 会在构建过程中自动生成 anas。install.rdf``install.rdf``install.rdf

I would recommend that take a look at the that is generated in the build process and duplicate it. You can then make changes to the file should you have things you would like to adjust.install.rdf

As for the file you are currently using, at a minimum, you probably need to add:install.rdf

<em:bootstrap>true</em:bootstrap>

That would probably be needed as all add-on SDK extensions are restartless. However, the best thing would be to take the automatically generated and only change the things you need.install.rdf