diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-29 07:51:07 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-29 09:16:18 (GMT) |
commit | 538153994cacc4613aef1eb8ef77e501be7f5a88 (patch) | |
tree | 5b1ae7732aa02e50d85a9f10280d3335f98e673b /tests | |
parent | 9e4aa947217d92c51d09a6adaddaf88829d42f89 (diff) | |
download | Qt-538153994cacc4613aef1eb8ef77e501be7f5a88.zip Qt-538153994cacc4613aef1eb8ef77e501be7f5a88.tar.gz Qt-538153994cacc4613aef1eb8ef77e501be7f5a88.tar.bz2 |
Enter a scope when enterning a native function.
so native function that would call
engine->evaluate("var b = 'foo');
would not change the global object.
The change in qscriptengine.cpp makes sure that the correct scope is
used for the execution of QScriptEngine::evaluate.
The changes in qscriptfunction.cpp push a new scope for native function
calls. We might want to move that into QScriptContext later
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 5b4d02d..9b0671f 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1283,6 +1283,9 @@ void tst_QScriptEngine::nestedEvaluate() QCOMPARE(result.property("thisObjectIdBefore").toString(), QString("foo")); QCOMPARE(result.property("thisObjectIdAfter").toString(), QString("foo")); QCOMPARE(result.property("evaluatedThisObjectId").toString(), QString("foo")); + QScriptValue bar = eng.evaluate("bar"); + QVERIFY(bar.isError()); + QCOMPARE(bar.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bar")); } void tst_QScriptEngine::uncaughtException() |