2016-11-02 73 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初始化」的新文件夾,複製粘貼別人的內容,先前初始化文件夾,裏面 - 你會得到上述錯誤。我的錯誤。