From e2ae9ddf6d619e10b7f7040f4d37e3e44799a56e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 22 Mar 2013 12:15:19 +0100 Subject: [PATCH] Fix ch12/12.2/12.2.1/12.2.1-21-s (indirect eval call writing to arguments should not throw type error) Correctly propagate needsActivation, usesArgumentsObject and strictMode from the parsed eval code to the ScriptFunction before creating the call context. Also don't let the qml activation object overwrite an existing one unless provided. Change-Id: Ia92e9c40f947cbe09984fca6ecb0d1e03205ff51 Reviewed-by: Lars Knoll --- src/v4/qv4globalobject.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp index 0520d7b..1527798 100644 --- a/src/v4/qv4globalobject.cpp +++ b/src/v4/qv4globalobject.cpp @@ -386,27 +386,32 @@ Value EvalFunction::evalCall(ExecutionContext *parentContext, Value /*thisObject if (!f) return Value::undefinedValue(); - bool strict = f->isStrict || (ctx->strictMode); + strictMode = f->isStrict || (ctx->strictMode); if (qmlActivation) - strict = true; + strictMode = true; - if (strict) { + usesArgumentsObject = f->usesArgumentsObject; + needsActivation = f->needsActivation(); + + if (strictMode) { ExecutionContext *k = ctx->engine->newCallContext(this, ctx->thisObject, 0, 0); - k->activation = qmlActivation; - k->qmlObject = qmlActivation; + if (qmlActivation) { + k->activation = qmlActivation; + k->qmlObject = qmlActivation; + } ctx = k; } // set the correct strict mode flag on the context bool cstrict = ctx->strictMode; - ctx->strictMode = strict; + ctx->strictMode = strictMode; Value result = Value::undefinedValue(); try { result = f->code(ctx, f->codeData); } catch (Exception &ex) { ctx->strictMode = cstrict; - if (strict) + if (strictMode) ex.partiallyUnwindContext(parentContext); throw; } -- 2.7.4