JPM [error] Message: SyntaxError: duplicate label

折月煮酒 提交于 2019-12-11 23:32:46

问题


I'm working on a firefox extension and am getting this error message. What does it mean?

The only label I have is from:

require("sdk/ui/button/action").ActionButton({
    id: "show-popup",
    label: "something that can't possibly be a duplicate",
    ...

Later on I add a background page:

require("sdk/page-worker").Page({
    contentScript: [ ... some scripts ... ]
});

While testing, I get the error:

> jpm run -b $(which firefox)
JPM [info] Starting jpm run on MyExtensionTitle
JPM [info] Creating a new profile
console.error: myextensiontitle: 
JPM [error]   Message: SyntaxError: duplicate label

This only happens when I add the background script. How can I debug further? All I have to go on is an ambiguous terminal message and no line number.


回答1:


A page-worker's contentScript is the source code. It should be contentScriptFile instead:

require("sdk/page-worker").Page({
    contentScriptFile: [ ... some scripts ... ]
});


来源:https://stackoverflow.com/questions/35029914/jpm-error-message-syntaxerror-duplicate-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!