On Aug 7, 2012, at 9:27 PM, Boris Zbarsky wrote:

> On 8/7/12 9:51 AM, Matthew Gertner wrote:
>> 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!"; }
>> };
> 
> Should there be a "new foo()" somewhere here?

Maybe this example isn't quite right since (as usual) I conflated the global 
object and the context. I should have said something like:

var context = { properties: {} };
...

And in the subscript:

properties.foo = function() {
...
}

In other words, I am making the object constructor accessible outside of the 
subscript.

> 
> Does applying the patch in bug 780542 change behavior for you?

Based on the feedback in this thread, the behavior seems consistent with that 
described in https://wiki.mozilla.org/XPConnect_Chrome_Object_Wrappers. When I 
expose the prototype using __exposedProps__ then the problem goes away. So 
unless you have reason for believing otherwise, I don't think this is a bug.

Matt
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to