Hi, I'm making an extension that on load of every page creates an instance of my xpcom component specifically for that page.
I do that like this:
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent) {
appcontent.addEventListener("load", onPageLoad, true);
}
var onPageLoad = function(aEvent) {
var doc = aEvent.originalTarget; //this is the reference to the opened page
pages.push(createInstanceOfMyXPCOM(doc));
}
My question is, within the XPCOM component, how can I use eval() within the global context of that doc. If you would just do this in a regular javascript in html you could do:
window.eval.call(window, somecode);
The problem is I don't have window variable in my xpcom component (or do I), I only have the reference to the document. I could pass the window to my XPCOM component on creation as well, but if I have several pages opened, I don't see how that would work..