diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-03-22 12:15:19 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-03-23 19:16:47 +0100 |
commit | e2ae9ddf6d619e10b7f7040f4d37e3e44799a56e (patch) | |
tree | 4b1be08518ed3f818c1b78a3a9c653bb5e40e676 /src | |
parent | 507fc52f0780756c6b3c83a00f40262b337061b5 (diff) |
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 <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/v4/qv4globalobject.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp index 0520d7bf7b..15277981d1 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; } |