diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
commit | 437e83e7707516129f68ee26aca5349845b7cc7b (patch) | |
tree | 0d4c8721f21acc5398e4eabff88a902cb23d0521 /src/script/bridge | |
parent | 7b3880475d02bd3db630387bccccc7e1ef9d4e9a (diff) | |
parent | e61071a2a170eaeb524778e9e903100323b88bbe (diff) | |
download | Qt-437e83e7707516129f68ee26aca5349845b7cc7b.zip Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.gz Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
configure
doc/src/snippets/code/doc_src_qmake-manual.qdoc
mkspecs/features/symbian/application_icon.prf
mkspecs/features/symbian/default_post.prf
mkspecs/features/symbian/symbian_building.prf
qmake/generators/symbian/initprojectdeploy_symbian.cpp
src/multimedia/audio/audio.pri
src/network/access/qnetworkaccessmanager.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/qgl_p.h
src/plugins/bearer/corewlan/qcorewlanengine.mm
src/plugins/phonon/mmf/mmf.pro
tests/auto/qscriptvalue/tst_qscriptvalue.cpp
tests/auto/qscriptvalue/tst_qscriptvalue.h
tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/script/bridge')
-rw-r--r-- | src/script/bridge/qscriptclassobject.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index 28f7bd1..51c0976 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -78,6 +78,12 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object, scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id); if (flags & QScriptClass::HandlesReadAccess) { QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } slot.setValue(engine->scriptValueToJSCValue(value)); return true; } @@ -119,6 +125,12 @@ bool ClassObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object, attribs |= pflags & QScriptValue::UserRange; // Rather than calling the getter, we could return an access descriptor here. QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } descriptor.setDescriptor(engine->scriptValueToJSCValue(value), attribs); return true; } |