bool JS_SetPrototype(JSContext *cx, JS::HandleObject obj, JS::HandleObject proto);
||The context in which to set the object's prototype. Requires request. In a
||The object to modify.|
||The object to set as the new prototype of
JS_SetPrototype sets the prototype object for a specified object. A prototype object provides properties that are shared by similar JS object instances. Ordinarily you set a prototype for an object when you create the object with
JS_NewObject, but if you do not set a prototype at that time, you can later call
JS_SetPrototype to do so.
obj is a pointer to an existing JS object, and
proto is a pointer to second existing object upon which the first object is to be based.
true. Otherwise it returns
To get an object's prototype, use