Introduced in JavaScript 1.8.1

Finds a specified property of an object and gets a detailed description of that property.


struct JSPropertyDescriptor {
    JSObject           *obj;
    uintN              attrs;
    JSPropertyOp       getter;
    JSStrictPropertyOp setter;
    jsval              value;
    uintN              shortid;

JSBool JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id,
                                    uintN flags, JSPropertyDescriptor *desc);
Name Type Description
cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
obj JSObject * The object to search for the property.
id jsid The name of the property to look up.
flags uintN A combination of bits requesting special search behavior. See Flags below.
desc JSPropertyDescriptor * Out parameter. On success, if no property is found, desc->obj is set to NULL. If a property is found, *desc receives a description of it.


MXR ID Search for JS_GetPropertyDescriptorById

The JSPropertyDescriptor structure

The JSPropertyDescriptor structure to which you provide a pointer in the desc parameter is filled out as follows on return.

Field Name Type Description
obj JSObject * A pointer to the object representing the property with the ID specified in the id parameter, or NULL if no matching property was found.
attrs uintN ??
getter JSPropertyOp A callback that returns the value of the property.
setter JSStrictPropertyOp A callback to set the value of the property.
value jsval The property's current value.
shortid uintN ??

Document Tags and Contributors

Contributors to this page: Sheppy, MarkGiffin, Jorend
Last updated by: Sheppy,