diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-23 14:16:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-27 05:17:13 +0200 |
commit | 965588737321d10fd1fbca3f89b4c6257b7b5d47 (patch) | |
tree | 95d069b6ce910c4f8bf8f71d50bebc4fe35a6b1f /src/qml/qml/v4 | |
parent | 4a161cfa0cf9167b575bdf7ff5685b9bf17c6960 (diff) |
Restrict v8 property lookup to the execution context
When resolving property names, only properties known to the current
context of execution should be available. If a property name has
been overriden by a component extension, code executing in the
context of the base component should resolve the property name to
the property available inside the base component or its bases.
Task-number: QTBUG-24891
Change-Id: I9687cc28e108226d5a939627a901c8254344b598
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/qml/qml/v4')
-rw-r--r-- | src/qml/qml/v4/qv4bindings.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v4/qv4irbuilder.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index bd67a8d5e4..ddc94d8ce4 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -864,7 +864,7 @@ inline quint32 QV4Bindings::toUint32(double n) } \ QQmlPropertyData *prop = (data && data->propertyCache) ? data->propertyCache->property((index)) : 0; \ if (prop && prop->isOverridden()) { \ - int resolvedIndex = data->propertyCache->property(prop->name(obj))->coreIndex; \ + int resolvedIndex = data->propertyCache->property(prop->name(obj), obj, context)->coreIndex; \ if ((int)index < resolvedIndex) { \ *(inv) = true; \ goto programExit; \ diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 37d71f1941..45e3a72986 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -466,7 +466,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QQmlPropertyCache *cache = m_expression->context->synthCache; if (!cache) cache = m_expression->context->metatype; - QQmlPropertyData *data = cache->property(name); + QQmlPropertyData *data = cache->property(name, 0, 0); if (data && data->hasRevision()) { if (qmlVerboseCompiler()) @@ -486,7 +486,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QQmlPropertyCache *cache = m_expression->component->synthCache; if (!cache) cache = m_expression->component->metatype; - QQmlPropertyData *data = cache->property(name); + QQmlPropertyData *data = cache->property(name, 0, 0); if (data && data->hasRevision()) { if (qmlVerboseCompiler()) @@ -612,7 +612,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) << (*baseName->id + QLatin1Char('.') + ast->name.toString()); } else if(const QMetaObject *attachedMeta = baseName->declarativeType->attachedPropertiesType()) { QQmlPropertyCache *cache = m_engine->cache(attachedMeta); - QQmlPropertyData *data = cache->property(name); + QQmlPropertyData *data = cache->property(name, 0, 0); if (!data || data->isFunction()) return false; // Don't support methods (or non-existing properties ;) @@ -647,7 +647,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) } else { QQmlPropertyCache *cache = baseName->meta.propertyCache(m_engine); if (!cache) return false; - QQmlPropertyData *data = cache->property(name); + QQmlPropertyData *data = cache->property(name, 0, 0); if (!data || data->isFunction()) return false; // Don't support methods (or non-existing properties ;) @@ -666,7 +666,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) QQmlPropertyCache *cache = idObject->synthCache?idObject->synthCache:idObject->metatype; - QQmlPropertyData *data = cache->property(name); + QQmlPropertyData *data = cache->property(name, 0, 0); if (!data || data->isFunction()) return false; // Don't support methods (or non-existing properties ;) @@ -690,7 +690,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) if (!cache) return false; - if (QQmlPropertyData *data = cache->property(name)) { + if (QQmlPropertyData *data = cache->property(name, 0, 0)) { if (!baseName->property->isFinal() || !data->isFinal()) _invalidatable = true; |