Thanks, Simon, that did the trick.
On Aug 7, 2012, at 6:16 PM, Simon Kornblith wrote:
> Have you tried:
>
> foo.__exposedProps__ = {"prototype":"r"};
>
> (If this is indeed the issue, you should probably set __exposedProps__
> for the prototype as well. Newer Firefox versions warn about missing
> __exposedProps__ on objects, although I think it's only required for
> functions ATM.)
>
> Simon
>
> On Aug 7, 9:51 am, Matthew Gertner <[email protected]> wrote:
>> 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
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform