Firefox addon 入门教程中的ActionButton不起作用

Firefox addon 入门教程中的ActionButton不起作用,firefox-addon,firefox-addon-sdk,Firefox Addon,Firefox Addon Sdk,我是firefox插件开发的新手,我不明白为什么教程中最简单的示例不起作用 我从这里准确地遵循了所有步骤: 我在浏览器窗口的任何地方都找不到加载项按钮。仅标准按钮: 附加sdk似乎设置正确,cfx工作正常。以下是cfx run的控制台输出: (addon-sdk-1.17)[12:40:05]sergey@linuxmain:my-addon> cfx run Using binary at '/usr/bin/firefox'. (process:10986): GLib-CRITI

我是firefox插件开发的新手,我不明白为什么教程中最简单的示例不起作用

我从这里准确地遵循了所有步骤: 我在浏览器窗口的任何地方都找不到加载项按钮。仅标准按钮:

附加sdk似乎设置正确,cfx工作正常。以下是cfx run的控制台输出:

(addon-sdk-1.17)[12:40:05]sergey@linuxmain:my-addon> cfx run
Using binary at '/usr/bin/firefox'.

(process:10986): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Using profile at '/tmp/tmpPxd9iD.mozrunner'.

(process:10996): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed

(process:11006): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
[10996] WARNING: Attempt to add property GnomeProgram::sm-connect after class was initialised: 'glib warning', file /home/abuild/rpmbuild/BUILD/mozilla/toolkit/xre/nsSigHandlers.cpp, line 140

(firefox:10996): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::sm-connect after class was initialised
[10996] WARNING: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised: 'glib warning', file /home/abuild/rpmbuild/BUILD/mozilla/toolkit/xre/nsSigHandlers.cpp, line 140

(firefox:10996): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised
[10996] WARNING: Attempt to add property GnomeProgram::display after class was initialised: 'glib warning', file /home/abuild/rpmbuild/BUILD/mozilla/toolkit/xre/nsSigHandlers.cpp, line 140

(firefox:10996): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::display after class was initialised
[10996] WARNING: Attempt to add property GnomeProgram::default-icon after class was initialised: 'glib warning', file /home/abuild/rpmbuild/BUILD/mozilla/toolkit/xre/nsSigHandlers.cpp, line 140

(firefox:10996): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::default-icon after class was initialised
JavaScript error: resource://app/components/nsBrowserGlue.js, line 1610: NS_ERROR_FILE_NOT_FOUND: Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIPrefBranch.getComplexValue]
这个输出的最后一行是关于什么的?也许这就是原因

附加文件和Python版本:

(addon-sdk-1.17)[12:46:06]sergey@linuxmain:my-addon> ls data/
icon-16.png  icon-32.png  icon-64.png
(addon-sdk-1.17)[12:46:10]sergey@linuxmain:my-addon> cat lib/main.js
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");

var button = buttons.ActionButton({
  id: "mozilla-link",
  label: "Visit Mozilla",
  icon: {
    "16": "./icon-16.png",
    "32": "./icon-32.png",
    "64": "./icon-64.png"
  },
  onClick: handleClick
});

function handleClick(state) {
  tabs.open("https://www.mozilla.org/");
}
(addon-sdk-1.17)[12:46:15]sergey@linuxmain:my-addon> python --version
Python 2.7.6
我运行Firefox版本36.0。加载项本身已存在:

那么我错过了什么?如何将附加按钮带到面板

Upd:

如果禁用加载项,打开并清除浏览器控制台,然后重新启用加载项,则会得到以下控制台输出:

Warning: attempting to write 4867 bytes to preference extensions.bootstrappedAddons. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file.
Warning: attempting to write 4670 bytes to preference extensions.xpiState. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file.

因此没有红色错误。

您可能有加载项启动错误。要轻松检查此项,请先禁用加载项,然后打开浏览器控制台,单击“清除”清除所有消息,然后再次启用加载项。您应该会看到任何与插件初始化相关的错误或异常。此外,您的代码在使用cfx或在Firefox 36以及当前夜间版本中测试时,对我来说运行良好。你在运行哪个版本?@canuckistani我运行36.0版。正如你所说,我试图禁用并重新启用插件(将结果添加到问题中),但它没有显示任何错误。此外,如果我将插件安装到已经运行的Firefox实例上,而不是启动
cfx run
,那么它也可以正常工作。您是否可以手动检查main.js文件内容是否与指南中的示例完全相同?您找到解决方案了吗?