This commit is contained in:
Jeff Walden 2010-03-26 22:10:39 -07:00
commit 34f9abcc39
2 changed files with 4 additions and 38 deletions

View File

@ -4841,36 +4841,6 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval)
return ok; return ok;
} }
JS_PUBLIC_API(JSBool)
JS_ExecuteScriptPart(JSContext *cx, JSObject *obj, JSScript *script,
JSExecPart part, jsval *rval)
{
JSScript tmp;
JSBool ok;
/* Make a temporary copy of the JSScript structure and farble it a bit. */
tmp = *script;
if (part == JSEXEC_PROLOG) {
tmp.length = tmp.main - tmp.code;
} else {
tmp.length -= tmp.main - tmp.code;
tmp.code = tmp.main;
}
/* Tell the debugger about our temporary copy of the script structure. */
const JSDebugHooks *hooks = cx->debugHooks;
if (hooks->newScriptHook) {
hooks->newScriptHook(cx, tmp.filename, tmp.lineno, &tmp, NULL,
hooks->newScriptHookData);
}
/* Execute the farbled struct and tell the debugger to forget about it. */
ok = JS_ExecuteScript(cx, obj, &tmp, rval);
if (hooks->destroyScriptHook)
hooks->destroyScriptHook(cx, &tmp, hooks->destroyScriptHookData);
return ok;
}
/* Ancient uintN nbytes is part of API/ABI, so use size_t length local. */ /* Ancient uintN nbytes is part of API/ABI, so use size_t length local. */
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_EvaluateScript(JSContext *cx, JSObject *obj, JS_EvaluateScript(JSContext *cx, JSObject *obj,

View File

@ -2261,10 +2261,10 @@ extern JS_PUBLIC_API(JSString *)
JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent); JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent);
/* /*
* NB: JS_ExecuteScript, JS_ExecuteScriptPart, and the JS_Evaluate*Script* * NB: JS_ExecuteScript and the JS_Evaluate*Script* quadruplets use the obj
* quadruplets all use the obj parameter as the initial scope chain header, * parameter as the initial scope chain header, the 'this' keyword value, and
* the 'this' keyword value, and the variables object (ECMA parlance for where * the variables object (ECMA parlance for where 'var' and 'function' bind
* 'var' and 'function' bind names) of the execution context for script. * names) of the execution context for script.
* *
* Using obj as the variables object is problematic if obj's parent (which is * Using obj as the variables object is problematic if obj's parent (which is
* the scope chain link; see JS_SetParent and JS_NewObject) is not null: in * the scope chain link; see JS_SetParent and JS_NewObject) is not null: in
@ -2304,10 +2304,6 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval);
*/ */
typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart; typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart;
extern JS_PUBLIC_API(JSBool)
JS_ExecuteScriptPart(JSContext *cx, JSObject *obj, JSScript *script,
JSExecPart part, jsval *rval);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_EvaluateScript(JSContext *cx, JSObject *obj, JS_EvaluateScript(JSContext *cx, JSObject *obj,
const char *bytes, uintN length, const char *bytes, uintN length,