Please note, this is a STATIC archive of website from 03 Nov 2016, does not collect or store any user information, there is no "phishing" involved.


Obsolete since JSAPI 26
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Get the attributes of a specified property.


JS_GetPropertyAttributes(JSContext *cx, JSObject *obj,
    const char *name, unsigned int *attrsp, JSBool *foundp);

JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj,
    const jschar *name, size_t namelen,
    unsigned int *attrsp, JSBool *foundp);
Name Type Description
cx JSContext * The context in which to look up property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
obj JSObject * The object that has the property to be queried.
name const char * or const jschar * Name of the property from which to retrieve attributes.
namelen size_t (only in JS_GetUCPropertyAttributes) The length of name in characters; or (size_t) -1 to indicate that name is null-terminated.
attrsp unsigned int * Out parameter. If the specified property is found on obj, *attrsp receives its attributes.
foundp JSBool * Out parameter. If no error occurs, *foundp receives JS_TRUE if the specified property is found and JS_FALSE if it is not found. If an error occurs, the value left in *foundp is unspecified.


JS_GetPropertyAttributes retrieves the property attributes of the property with the given name on a given object, obj. JS_GetUCPropertyAttributes is the Unicode version of the function.

If an error occurs, the return value is JS_FALSE, and the values left in *attrsp and *foundp are unspecified.

If obj does not have the specified property, or if it inherits it from some other object (on its prototype chain, for example), then *foundp is set to JS_FALSE. The value left in *attrsp is unspecified. The return value is JS_TRUE (to indicate that no error occurred).

If the property exists and belongs to obj, then *foundp is set to JS_TRUE, *attrsp is set to the logical OR of zero or more Property attributes flags, and the function returns JS_TRUE.

See Also

Document Tags and Contributors

 Contributors to this page: teoli, arai, fscholz, Jorend, Dria, MMondor, Nickolay, Tservo
 Last updated by: teoli,