Entry: JS_SetUCProperty (Function)
Summary: Sets the current value of a Unicode-encoded property belonging to a specified object.
Syntax:
JSBool JS_SetUCProperty(JSContext *cx, JSObject *obj,
const char *name, jsval *vp);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
obj JSObject * Object to which the property to set belongs.
name const jschar * Name of the property to set.
namelen size_t Length, in bytes, of the name of the property to set.
vp jsval * Pointer to the value to set for the property.
Description:
JS_SetUCProperty sets the current value of a property for a specified object. If the property does not exist, this function creates it, and inherits its attributes from a like-named property in the object's prototype chain. For properties it creates, JS_SetUCProperty sets the JSPROP_ENUMERATE attribute in the property's flags field; all other values for the property are undefined.
name is the property to set, namelen indicates the size, in bytes, of name, and vp is a pointer to the new value to set for the property. On successfully setting a property to a new value, JS_SetUCProperty returns JS_TRUE. Otherwise it returns JS_FALSE.
If you attempt to set the value for a read-only property using JavaScript 1.2 or earlier, JS_SetUCProperty reports an error and returns JS_FALSE. For JavaScript 1.3 and greater, such an attempt is silently ignored.
If you attempt to set the value for a property that does not exist, and there is a like-named read-only property in the object's prototype chain, JS_SetUCProperty creates a new read-only property on the object, sets its value to JSVAL_VOID, and reports a read-only violation error.
See also:
|
|
|