It is a Firefox add-on SDK.
I want to load a frame script to a given browser tab (complying with e10s).
Currently I try to do this for every tab (just for testing), but message manager is undefined. Why?
var self = require("sdk/self");
var { setTimeout} = require ("sdk/timers");
var { viewFor } = require("sdk/view/core");
function myFunc() {
var tabs = require("sdk/tabs");
for (let tab of tabs) {
console.log(tab.title);
var xulTab = viewFor(tab);
console.log(xulTab.messageManager);
console.log(tab.messageManager);
}
}
Both log
print out undefined
I need messageManager
object in order to call loadFrameScript
function afterwards. Thank you very much!
Excellent question. This is e10s safe:
var mm = xulTab.linkedBrowser.messageManager
Then you can use it as normal such as: mm.sendAsyncMessage(....)