summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4globalobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-21 07:57:37 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-21 10:42:22 +0000
commit397db42518c93b81a3b24ecfd27ec4e63c6fc31d (patch)
treec44c977f66e54ca39ef89b0f350ad60cf2c992d8 /src/qml/jsruntime/qv4globalobject.cpp
parent89b41b0e99e075673f4976e5b94919fa1917e203 (diff)
downloadqtdeclarative-397db42518c93b81a3b24ecfd27ec4e63c6fc31d.tar.gz
Fix indirect, strict calls to eval
In this case, the thisObject is supposed to be the global object and not the thisObject of the parent stack frame. Amends 661f9203c411b080fce6abf606ec8fb5c17a6bfe Change-Id: I9560a0bdfe24f43f877d28c7c98a42fcc1416e86 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4globalobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 395b2e8afb..bd8e747c41 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -374,7 +374,10 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const
if (function->isStrict() || (ctx->d()->v4Function->isStrict())) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
- callData->thisObject = scope.engine->currentStackFrame->thisObject();
+ if (directCall)
+ callData->thisObject = scope.engine->currentStackFrame->thisObject();
+ else
+ callData->thisObject = scope.engine->globalObject;
return e->call(callData);
}