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.

JS_ExecuteScriptPart has been removed in bug 555104. Use JS_ExecuteScript instead.

Executes a part of a compiled script.


typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart;

JSBool JS_ExecuteScriptPart(
    JSContext *cx, JSObject *obj, JSScript *script,
    JSExecPart part, jsval *rval);
Name Type Description
cx JSContext * The context in which to execute the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
obj JSObject * The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript.
script JSScript * The compiled script to execute.
part JSExecPart The part of script to execute.
rval jsval * Out parameter. On success, *rval receives the value from the last executed expression statement in the script.


JS_ExecuteScriptPart executes part of a previously compiled script, script. The part parameter must be either JSEXEC_PROLOG to execute the script prolog or JSEXEC_MAIN to execute the main section of the script.

If the script executes successfully, JS_ExecuteScriptPart stores the value of the last-executed expression statement in the script in *rval and returns JS_TRUE. Otherwise it returns JS_FALSE, and the value left in *rval is undefined.

To execute both parts of a script, use JS_ExecuteScript instead.

MXR ID Search for JS_ExecuteScriptPart

Document Tags and Contributors

 Last updated by: Jorend,