summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptcontext.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-14 12:20:56 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-14 12:20:56 (GMT)
commit4c31f59d45130eae8f140e6d0177a4b227454187 (patch)
treef03c06fc796c7ae254c342d4016ef13f5c0a3c5e /src/script/api/qscriptcontext.cpp
parente0a86dc604b87921652b844a5f85889bb6291ed9 (diff)
downloadQt-4c31f59d45130eae8f140e6d0177a4b227454187.zip
Qt-4c31f59d45130eae8f140e6d0177a4b227454187.tar.gz
Qt-4c31f59d45130eae8f140e6d0177a4b227454187.tar.bz2
make sure QScriptContext::scopeChain() returns the right object
Follow-up to commit e0a86dc604b87921652b844a5f85889bb6291ed9. Just like in the activationObject() function, we need to check if the activation object is actually a proxy to another object, and return that other object if that's the case (the proxy object should not be exposed to the public).
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r--src/script/api/qscriptcontext.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index 4a78f7c..01ccb6d 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -671,8 +671,15 @@ QScriptValueList QScriptContext::scopeChain() const
JSC::ScopeChainNode *node = frame->scopeChain();
JSC::ScopeChainIterator it(node);
for (it = node->begin(); it != node->end(); ++it) {
- if (*it)
- result.append(engine->scriptValueFromJSCValue(*it));
+ JSC::JSObject *object = *it;
+ if (!object)
+ continue;
+ if (object->isObject(&QScript::QScriptActivationObject::info)
+ && (static_cast<QScript::QScriptActivationObject*>(object)->delegate() != 0)) {
+ // Return the object that property access is being delegated to
+ object = static_cast<QScript::QScriptActivationObject*>(object)->delegate();
+ }
+ result.append(engine->scriptValueFromJSCValue(object));
}
return result;
}