Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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

Syntax

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.

Description

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.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, tschneidereit, Jorend, Nickolay, Waldo, Michelemostarda
 Last updated by: arai,