diff --git a/src/ecmascript/see.c b/src/ecmascript/see.c index 8b084cbcf..d7a3cc649 100644 --- a/src/ecmascript/see.c +++ b/src/ecmascript/see.c @@ -209,6 +209,7 @@ see_eval_boolback(struct ecmascript_interpreter *interpreter, struct SEE_interpreter *interp = interpreter->backend_data; struct global_object *g = (struct global_object *)interp; struct SEE_input *input = see_input_elinks(interp, code->source); + struct SEE_object *fun; SEE_try_context_t try_ctxt; struct SEE_value result; struct SEE_value *e; @@ -220,7 +221,8 @@ see_eval_boolback(struct ecmascript_interpreter *interpreter, g->exec_start = time(NULL); g->ret = NULL; SEE_TRY(interp, try_ctxt) { - SEE_Global_eval(interp, input, &result); + fun = SEE_Function_new(interp, NULL, NULL, input); + SEE_OBJECT_CALL(interp, fun, NULL, 0, NULL, &result); /* history.back() returns SEE_NULL */ if (SEE_VALUE_GET_TYPE(&result) == SEE_NULL) res = 0; diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index b326f69f1..84d5e06c7 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -288,6 +288,7 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code) { JSContext *ctx; + JSFunction *fun; jsval rval; int ret; @@ -295,8 +296,12 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, ctx = interpreter->backend_data; setup_safeguard(interpreter, ctx); interpreter->ret = NULL; - ret = JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx), - code->source, code->length, "", 0, &rval); + fun = JS_CompileFunction(ctx, NULL, "", 0, NULL, code->source, + code->length, "", 0); + if (!fun) + return -1; + + ret = JS_CallFunction(ctx, NULL, fun, 0, NULL, &rval); if (ret == 2) { /* onClick="history.back()" */ return 0; }