JS_ValueToSource

Convert a JS::Value to a JavaScript source.

Syntax

JSString *
JS_ValueToSource(JSContext *cx, JS::Handle<JS::Value> v);
Name Type Description
cx JSContext * The context in which to perform the conversion. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
v JS::Handle<JS::Value> The value to convert.

Description

JS_ValueToSource converts a specified JavaScript value, v, to a JavaScript source.

On success, JS_ValueToSource returns a pointer to a string. On error or exception, it returns NULL. This happens, for example, if v is an object and v.toSource() throws an exception.

See Also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai
 Last updated by: kscarfone,