Bug 555104 - remove JS_ExecuteScriptPart (r=brendan)

This commit is contained in:
Luke Wagner 2010-03-26 19:37:45 -07:00
parent 2cef2bed83
commit 13df6efbae
2 changed files with 4 additions and 38 deletions

View File

@ -4840,36 +4840,6 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval)
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. */
JS_PUBLIC_API(JSBool)
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);
/*
* NB: JS_ExecuteScript, JS_ExecuteScriptPart, and the JS_Evaluate*Script*
* quadruplets all use the obj parameter as the initial scope chain header,
* the 'this' keyword value, and the variables object (ECMA parlance for where
* 'var' and 'function' bind names) of the execution context for script.
* NB: JS_ExecuteScript and the JS_Evaluate*Script* quadruplets use the obj
* parameter as the initial scope chain header, the 'this' keyword value, and
* the variables object (ECMA parlance for where 'var' and 'function' bind
* names) of the execution context for script.
*
* 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
@ -2304,10 +2304,6 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval);
*/
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)
JS_EvaluateScript(JSContext *cx, JSObject *obj,
const char *bytes, uintN length,