2016-11-02 75 views
0

从昨天晚上开始,当我尝试与内容脚本进行通信时,在出现“准备就绪”事件触发加载页面的标签后,该脚本正在附加到。Firefox SDK扩展 - JPM错误

console.error: 
JPM [error] Message: TypeError: this.sandbox is undefined 
Stack: 
[email protected]://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/content/worker-child.js:87:7 
[email protected]://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:112:9 
[email protected]://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:89:38 
[email protected]://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/remote/child.js:67:37 

在绝望中我甚至试图复制粘贴了Mozilla网站代码:

在index.js

var data = require("sdk/self").data; 
var pageMod = require("sdk/page-mod"); 

pageMod.PageMod({ 
    include: "*", 
    contentScriptFile: data.url("element-getter.js"), 
    onAttach: function(worker) { 
    worker.port.emit("myCustomEvent", "mymessage"); 
    worker.port.on("backEvent", function(content) { 
    console.log(content); 
    }); 
    } 
}); 
在element.getter.js

self.port.on("myCustomEvent", function(message) { 
    self.port.emit("backEvent", "newMessage"); 
}); 

在尝试通过工作人员在主脚本和内容脚本之间进行通信时出现相同的错误,使用“tabs”sdk mod ULE。

编辑: 如果确认/否认这种行为,可以请别人吗?

欢迎任何想法!

我已经提交bug报告在这里:https://bugzilla.mozilla.org/show_bug.cgi?id=1314557

+0

您正在使用哪个版本的Firefox?你最近更新了吗? – Makyen

+0

@Makyen最新FF开发版。 51.0a2(2016-11-01) - 我猜这是来自昨晚的更新。 –

回答

0

洙..如果你不“JPM初始化”的新文件夹,复制粘贴别人的内容,先前初始化文件夹,里面 - 你会得到上述错误。我的错误。