JS_PropertyStub

Default implementations of the required callbacks in JSClass.

Syntax

JSBool JS_PropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp);

JSBool JS_EnumerateStub(JSContext *cx, JSObject *obj);

JSBool JS_ResolveStub(JSContext *cx, JSObject *obj, jsid id);

JSBool JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp);

void JS_FinalizeStub(JSContext *cx, JSObject *obj); Obsolete since JSAPI 15

Description

The stub functions are not designed to be called directly by a JSAPI application. Rather, they are convenient stand-ins anywhere the JSAPI requires callbacks of certain types. Examples at JSClass illustrate how stub functions can be used.

JS_PropertyStub is of type JSPropertyOp, the type of getter and setter callbacks. It can be used in JSClass.addProperty, JSClass.getProperty, JSClass.setProperty, JSClass.delProperty, JSPropertySpec.getter and setter, JS_DefineProperty, JS_DefinePropertyWithTinyId, and JS_DefineElement. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns JS_TRUE.

JS_EnumerateStub is a stub for JSClass.enumerate. It does nothing and returns JS_TRUE.

JS_ResolveStub is a stub for JSClass.resolve. It does nothing and returns JS_TRUE.

JS_ConvertStub is a stub for JSClass.convert. Its behavior is the same as the default conversion behavior for Objects. It attempts to call the object's valueOf and toString functions, in the order determined by the specified type, in accordance with the default DefaultValue algorithm in ES5 ยง8.12.8.

JS_FinalizeStub is a stub for JSClass.finalize. It does nothing. Obsolete since JSAPI 15

MXR ID Search for JS_PropertyStub
MXR ID Search for JS_EnumerateStub
MXR ID Search for JS_ResolveStub
MXR ID Search for JS_ConvertStub

Document Tags and Contributors

Contributors to this page: MMondor, tschneidereit, Dria, Waldo, Jorend
Last updated by: tschneidereit,