diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-07-12 15:55:01 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-02 08:50:21 +0200 |
commit | 6f146a5d2ea893b13e4cfcd90243e66f7c9a0083 (patch) | |
tree | 2e94aef5c7f0a10bf28928dab40a43e5f9483826 /src/declarative/qml/v8/qv8typewrapper.cpp | |
parent | 0db6db0263defcd6ff84769b7d927d5a51606f6c (diff) |
Ensure that the prototype chain is checked in property Get
This commit ensures that the prototype chain is checked during
property Get operations on QObjects and other types in QML by
returning an empty handle from the property Get interceptor if
no valid property with the given name is found.
Task-number: QTBUG-20336
Change-Id: I670ee211c74c0fdcb68c3f91b29fcc0ea8b55d6f
Reviewed-on: http://codereview.qt.nokia.com/1477
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8typewrapper.cpp')
-rw-r--r-- | src/declarative/qml/v8/qv8typewrapper.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp index fe30670fc2..736ddc4e3d 100644 --- a/src/declarative/qml/v8/qv8typewrapper.cpp +++ b/src/declarative/qml/v8/qv8typewrapper.cpp @@ -150,7 +150,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, } } - // Fall through to undefined + // Fall through to return empty handle } else if (resource->object) { QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object); @@ -158,10 +158,10 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, return v8engine->qobjectWrapper()->getProperty(ao, propertystring, QV8QObjectWrapper::IgnoreRevision); - // Fall through to undefined + // Fall through to return empty handle } - // Fall through to undefined + // Fall through to return empty handle } else if (resource->typeNamespace) { @@ -185,21 +185,19 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, if (moduleApi->qobjectApi) { v8::Handle<v8::Value> rv = v8engine->qobjectWrapper()->getProperty(moduleApi->qobjectApi, propertystring, QV8QObjectWrapper::IgnoreRevision); - if (rv.IsEmpty()) - return v8::Undefined(); - else - return rv; + return rv; } else { - return v8::Undefined(); + return v8::Handle<v8::Value>(); } } - // Fall through to undefined + // Fall through to return empty handle } else { Q_ASSERT(!"Unreachable"); } - return v8::Undefined(); + + return v8::Handle<v8::Value>(); } v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property, |