为什么我在面板的Firefox Addon SDK内容脚本中出错?

时间:2014-12-13 06:04:30

标签: firefox firefox-addon firefox-addon-sdk

获取以下错误,即使将脚本设为空我也会出现此错误。

console.error: my-addon:
  Message: SyntaxError: expected expression, got end of script

我的插件的面板代码:

var { ToggleButton } = require('sdk/ui/button/toggle');
var panels = require("sdk/panel");
var self = require("sdk/self");
var ss = require("sdk/simple-storage");

var button = ToggleButton({
    id: "my-addon",
    label: "My Addon",
    icon: {
        "16": "./img/16-16.png",
        "32": "./img/32-32.png",
        "64": "./img/64-64.png"
    },
    onChange: handleChange
});

var panel = panels.Panel({
    contentURL: self.data.url("popup.html"),
    contentScript: self.data.url("js/pop_listener.js"),
    onHide: handleHide,
    width: 300,
    height: 550
});

1 个答案:

答案 0 :(得分:9)

使用contentScriptFile代替contentScript