Subj : Re: Convert non-READONLY property to READONLY property. To : netscape.public.mozilla.jseng From : J.P. Date : Mon Jul 12 2004 06:20 pm Brendan Eich wrote: > J.P. wrote: > >> In my application, the type and value of a property has to been >> determined at runtime, which means that I can't set READONLY in >> JS_DefinePropety(). But after the type and value has been set on that >> property, I want it to be READONLY. >> >> Is there any way I can achieve that? > > > JS_SetPropertyAttributes or JS_SetUCPropertyAttributes (call > JS_Get*PropertyAttributes first to if you want to preserve the other > attributes). > > /be 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." 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. Thanks. .