Obsolete since JavaScript 1.8.5
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.

Causes a native to return a Reference value (as allowed by ECMA 262-3 §11.2.3).

Syntax

void
JS_SetCallReturnValue2(JSContext *cx, jsval v);
Name Type Description
cx JSContext * The context in which the native function is running.
v jsval The ID of the property of the Reference value to be returned from the native.

Description

Calling JS_SetCallReturnValue2 indicates to the runtime that the native will return a value of type Reference.

The native must store the object part of the Reference value in *rval, and the argument v gives the ID of the property part of the Reference value. This Reference value can then be used as an lvalue in script.

An example is in js/src/js.c; searching for JS_SetCallReturnValue2 should find it.

See Also