mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix horrible bug in EvalInContext when the result is an object. rs=mrbkap.
This commit is contained in:
parent
0f2e011c39
commit
9ee0592d4e
@ -2996,25 +2996,27 @@ EvalInContext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
return true;
|
||||
|
||||
JSStackFrame *fp = JS_GetScriptedCaller(cx, NULL);
|
||||
JSAutoCrossCompartmentCall ac;
|
||||
if (sobj->isCrossCompartmentWrapper()) {
|
||||
sobj = sobj->unwrap();
|
||||
if (!ac.enter(cx, sobj))
|
||||
return false;
|
||||
}
|
||||
{
|
||||
JSAutoCrossCompartmentCall ac;
|
||||
if (sobj->isCrossCompartmentWrapper()) {
|
||||
sobj = sobj->unwrap();
|
||||
if (!ac.enter(cx, sobj))
|
||||
return false;
|
||||
}
|
||||
|
||||
OBJ_TO_INNER_OBJECT(cx, sobj);
|
||||
if (!sobj)
|
||||
return false;
|
||||
if (!(sobj->getClass()->flags & JSCLASS_IS_GLOBAL)) {
|
||||
JS_ReportError(cx, "Invalid scope argument to evalcx");
|
||||
return false;
|
||||
}
|
||||
if (!JS_EvaluateUCScript(cx, sobj, src, srclen,
|
||||
fp->script->filename,
|
||||
JS_PCToLineNumber(cx, fp->script, fp->pc(cx)),
|
||||
rval)) {
|
||||
return false;
|
||||
OBJ_TO_INNER_OBJECT(cx, sobj);
|
||||
if (!sobj)
|
||||
return false;
|
||||
if (!(sobj->getClass()->flags & JSCLASS_IS_GLOBAL)) {
|
||||
JS_ReportError(cx, "Invalid scope argument to evalcx");
|
||||
return false;
|
||||
}
|
||||
if (!JS_EvaluateUCScript(cx, sobj, src, srclen,
|
||||
fp->script->filename,
|
||||
JS_PCToLineNumber(cx, fp->script, fp->pc(cx)),
|
||||
rval)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return cx->compartment->wrap(cx, rval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user