diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-30 07:27:47 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-30 07:27:47 (GMT) |
commit | b742568492c56aee9445a1fbf3e90e9ef3cb5823 (patch) | |
tree | 765bfde02d759536e9a1f7cfe95772c89a8b3c3b /src/declarative/qml/qdeclarativeglobalscriptclass.cpp | |
parent | 89f21d7269ae7bf29e718958d00da84e5c60257f (diff) | |
download | Qt-b742568492c56aee9445a1fbf3e90e9ef3cb5823.zip Qt-b742568492c56aee9445a1fbf3e90e9ef3cb5823.tar.gz Qt-b742568492c56aee9445a1fbf3e90e9ef3cb5823.tar.bz2 |
Ensure eval and Function are in the correct scope
QTBUG-10236
Diffstat (limited to 'src/declarative/qml/qdeclarativeglobalscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeglobalscriptclass.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp index fc802b4..6e107fb 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp @@ -53,19 +53,29 @@ QT_BEGIN_NAMESPACE QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engine) : QScriptClass(engine) { + QString eval = QLatin1String("eval"); + QScriptValue globalObject = engine->globalObject(); + m_globalObject = engine->newObject(); + QScriptValue newGlobalObject = engine->newObject(); QScriptValueIterator iter(globalObject); + while (iter.hasNext()) { iter.next(); - m_globalObject.setProperty(iter.scriptName(), iter.value()); - m_illegalNames.insert(iter.name()); + + QString name = iter.name(); + + if (name != eval) + m_globalObject.setProperty(iter.scriptName(), iter.value()); + newGlobalObject.setProperty(iter.scriptName(), iter.value()); + + m_illegalNames.insert(name); } - QScriptValue v = engine->newObject(); - v.setScriptClass(this); - engine->setGlobalObject(v); + newGlobalObject.setScriptClass(this); + engine->setGlobalObject(newGlobalObject); } QScriptClass::QueryFlags |