问题
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