Subj : Re: Convert non-READONLY property to READONLY property. To : netscape.public.mozilla.jseng From : Brendan Eich Date : Mon Jul 12 2004 09:11 pm J.P. wrote: > 1. I will try that. But doesn't that conflict with following info, which > I found in the API doc of JSPROP_READONLY: > > "Property flags cannot be changed at run time. Instead, you either pass > a set of flags as an argument to JS_DefineProperty to create a single > property with fixed flag values, or you set property flags in a > JSPropertySpec struct which is then passed to the JS_DefineProperties > function to create multiple properties on a single object." Yes, the doc lies (again, although it would be more accurate, if I remember the history, to say that it predates the JS_*PropertyAttribute APIs). > 2. I noticed that setting a property READONLY doesn't make its children > properties READONLY. Is there anyway to do that in one-step? Or I have > to enumerate all the children? If I have to do the enumerating, how? I > couldn't find any function in API to do that. When you say "children", you must mean that the value of the property is an object that has its own properties. Making properties readonly does not prevent native objects from being extended with new properties, not does it preclude deletion of existing non-permanent properties. You might rather use JS_SealObject. You can use JS_Enumerate to enumerate enumerable properties of an object. /be .