When working with a code snippet in a Firefox addon like the one below:
var pagemod = PageMod({
include: ['*'],
contentScriptFile: [data.url('content.js')]
});
panel = require("sdk/panel").Panel({
width: 322,
height: 427,
contentURL: data.url("main.html"),
include:["http://*/*","https://*/*"],
contentScriptFile: [data.url('panel.js')]
});
I recently came across some example code in a Chrome extension where they utilize
window.parent.postMessage(message, "*")
to send messages and window.addEventListener("message",function (e) {//do something}
to receive them. How can I establish direct communication for message passing from "panel.js
" to "content.js
" within a Firefox addon?