diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-08 17:55:41 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-08 17:55:41 (GMT) |
commit | fc5d4032c2bc9f93dc1ae9e4c8b31d4968f672cb (patch) | |
tree | 574d11a388d8655c0575f4a9fb10e136638358fd /src/script/bridge/qscriptclassobject.cpp | |
parent | 198d903fa18d9f1d51615974d71de8236e97c2cd (diff) | |
parent | 551a8648b93055afa92c2938af5cede7495fd7f5 (diff) | |
download | Qt-fc5d4032c2bc9f93dc1ae9e4c8b31d4968f672cb.zip Qt-fc5d4032c2bc9f93dc1ae9e4c8b31d4968f672cb.tar.gz Qt-fc5d4032c2bc9f93dc1ae9e4c8b31d4968f672cb.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
fix build on mingw
Fix some painting issues in QDirectFBPaintEngine
QNAM: Do not need QNetworkSession in AlwaysCache load mode
Don't crash if QScriptClass property getter returns an invalid value
QNAM: Remove dead waitForUpstreamBytesWritten() code
QNAM: Remove dead waitForDownstreamReadyRead() code
fix memleak in test
Diffstat (limited to 'src/script/bridge/qscriptclassobject.cpp')
-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 dd229f1..228e755 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; } |