Firefox 插件 - 图标不显示

Firefox addon - icon not showing

我正在尝试为 Firefox 编写插件。为此,我使用 Mozilla "Addon-SDK"。

当我使用 "jpm run" 函数时一切正常。但是一旦我将它打包到 xpi 并安装它,该图标就不会显示在工具栏中。这似乎是 SDK 中的错误。
我尝试了其他博客文章中的各种变通解决方案。

这里最有用:

Firefox add-on : extension icon not showing
https://github.com/mozilla-jetpack/jpm/issues/197

由于必须验证 Firefox 43 插件。我这样做了。我还禁用了 about:config 中的功能,因此我可以更快地尝试新版本。仍然没有运气。

这是我在 index.js 中的代码:根据答案进行了编辑,但仍然无法正常工作

    var button = buttons.ActionButton(
    {
      id: "MorastLink",
      label: "In den Morast",
      icon:
      {
        "16": "./images/icon16.png",
        "32": "./images/icon32.png",
        "64": "./images/icon64.png"
      },
    onClick: CopyToMorast
    });  

这里我也试过了,移动路径,改名,使用绝对路径...

这是我的 package.json

    {
      "title": "Morast",
      "name": "morastaddon",
      "version": "0.1.4",
      "description": "An Addon to insert a \"Add to Morast\" button on distributer sites.",
      "main": "index.js",
      "author": "Lisa Austen",
      "icon": "ressource://@morastaddon/data/images/icon16.png",
      "icon64": "ressource://@morastaddon/data/images/icon64.png",
      "engines": {
      "firefox": ">=38.0a1",
      "fennec": ">=38.0a1" },
      "license": "MIT",
      "keywords": [
      "jetpack"
    ]
    }

https://github.com/LAusten/MorastAddon.git

根据 MDN,图标路径必须相对于 data 文件夹:

  • as a resource:// URL pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile)

  • as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory

示例:

  icon:
  {
    "16": "./images/icon16.png",
    "32": "./images/icon32.png",
    "64": "./images/icon64.png"
  }