I am using the content-document-global-created observer topic to add a function
to content windows when they are created. The function is used to load a
subscript like this:
var foo = window.loadSubscript("spec"); // loadSubscript() uses the subscript
loader internally
So the subscript should run with chrome privileges (loadSubscript is a function
defined in chrome). If foo is a function then I can call it from content.
However, if foo is an object constructor, it's prototype doesn't get through to
the content page. In other words, imagine that loadSubscript looks like this:
function loadSubscript(spec) {
var context = {};
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptLoader.loadSubScript(spec);
return context;
}
And the subscript is something like:
function foo() {
}
foo.prototype = {
do_something: function() { return "Hello, world!"; }
};
I would expect to see foo.prototype in the content page script at the beginning
of this message, but instead I see "undefined". I guess this is a security
issue but no warnings or errors are displayed when I test in a Firefox debug
build. Does anyone know what gives?
Matt
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform