Your Search Results


    This article is in need of a technical review.

    Retrieves an object's prototype.


    JS_GetPrototype(JSContext *cx, JS::HandleObject obj, JS::MutableHandleObject protop);
    Name Type Description
    cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
    obj JS::HandleObject Object for which to retrieve the prototype.
    protop JS::MutableHandleObject Out parameter. If successful, Receives prototype object of obj.


    JS_GetPrototype retrieves the prototype of a specified object, obj. A prototype object provides properties inherited by similar JS objects. This is the equivalent of Object.getPrototypeOf(obj) from javascript.

    If obj has a prototype, JS_GetPrototype stores a pointer to the prototype to *protop and returns true. Otherwise, it returns false and the value of *protop is undefined.

    To set an object's prototype, use JS_SetPrototype.

    See Also

    Document Tags and Contributors

    Contributors to this page: Sheppy, Dmandelin, ashb, Nickolay, arai, Jimb, Tservo, Dria, Jorend
    Last updated by: arai,
    Hide Sidebar