aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-10-15 14:31:52 +0200
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-10-20 07:36:29 +0000
commitd74da0f5a69e73bda91bb4270169da86b22a37b3 (patch)
tree2299bb7f8e9979d90d40f393e9dd5dd9ebb334c8 /src/qml/jsruntime/qv4context.cpp
parentaf390399c8017f69cfc9cdd4ef74144e6810fbe2 (diff)
Properly resolve the context to create mutable bindings on
This fixes a regression introduced in 5.5, where eval() calls in strict mode would still modify outer properties. Change-Id: I3ab70b45217eea16da68a4537e3c107b76794f2c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 403beacf39..007bf92639 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -114,23 +114,32 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
Scope scope(this);
// find the right context to create the binding on
- ScopedObject activation(scope, d()->engine->globalObject);
+ ScopedObject activation(scope);
ScopedContext ctx(scope, this);
while (ctx) {
switch (ctx->d()->type) {
case Heap::ExecutionContext::Type_CallContext:
case Heap::ExecutionContext::Type_SimpleCallContext: {
Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
- if (!c->activation)
- c->activation = scope.engine->newObject();
- activation = c->activation;
+ if (!activation) {
+ if (!c->activation)
+ c->activation = scope.engine->newObject();
+ activation = c->activation;
+ }
break;
}
case Heap::ExecutionContext::Type_QmlContext: {
+ // this is ugly, as it overrides the inner callcontext, but has to stay as long
+ // as bindings still get their own callcontext
Heap::QmlContext *qml = static_cast<Heap::QmlContext *>(ctx->d());
activation = qml->qml;
break;
}
+ case Heap::ExecutionContext::Type_GlobalContext: {
+ if (!activation)
+ activation = scope.engine->globalObject;
+ break;
+ }
default:
break;
}