Subj : Re: Class protection from multiple script execution using the same To : netscape.public.mozilla.jseng From : Matthew Mondor Date : Fri Jul 23 2004 07:20 am On Thu, 22 Jul 2004 11:21:20 -0400 Brendan Eich wrote: > In brief: > > - JSClass.addProperty will be called when a property is created in an > object. That includes the case where you predefine a property on a > class prototype, but override the property by setting it in an instance > that delegates to that prototype. If you don't want that "shadowing" > property to be created, you might use JSPROP_SHARED. I do not fully understand this part... Or at least how it would prevent from adding the properties from user js code if JSPROP_SHARED is added as part of the flags of a property... Yes addProperty() is called so I attempted to supply alternatives but without success to prevent the user js code from adding properties, without preventing the C code from doing so at API class setup... I also do not understand why if my alternative addProperty() method returns JS_FALSE that even attempting to change the value of an existing property (assignment using setProperty() fails). Or is it that it actually also calls addProperty() to create it's own copy for that runtime, since as you said properties are not shared? > - JS_SealObject can be used to make an object, or an arbitrary graph of > objects, immutable. If you want to seal an object graph, you need not > only to pass JS_TRUE for the |deep| parameter, but you must also isolate > > the graph from all other objects, by creating the entire object graph > on a dummy context. Ah this is probably what I need then, unfortunately I discovered no reference to those in the http://www.mozilla.org/js/spidermonkey/apidoc/complete-frameset.html reference... I will look at SpyderMonkey source then and attempt to use it. Thank you very much, Matt .