hello, I would like to ask about the nature of add-ons and e10s.
The idea is to expose and object from add-on script (index.js) to the html page (page.html).
In index.js
function getText() {
return “test”;
}
function f1() {
let domWindow = event.subject;
Components.utils.exportFunction(getText.bind(this, domWindow),
domWindow.crypto.wrappedJSObject,
{ defineAs: "getText" });
}
exports.main = function(options, callbacks) {
.
events.on(“content-document-global-created”, f1);
.
var pageMod = require(“sdk/page-mod”);
var data = require(“sdk/self”).data;
pageMod.PageMod({
include: [“file://", "”],
contentScript: ‘window.alert(“Matched!”);’,
contentScriptWhen: ‘ready’
});
}
In page (page.html)
the java script
function getText()
{
var text = window.crypto.getText();
document.getElementById(‘textId’).value = text;
}
the HTML body
<<INPUT type="text" size="10" name="textId" id="textId" value="" readonly>>
The Components.utils.exportFunction does not work for e10s. What is the alternative for the function?