summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-04 15:35:45 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-04 15:35:45 (GMT)
commit175b1689c9e173db62eb5612c7076531354e5252 (patch)
treedaef8b1350e4adfa6f770460acc303d59037db74
parent7025e0d29b653b575ad28556c9b78f7a8e040b49 (diff)
downloadQt-175b1689c9e173db62eb5612c7076531354e5252.zip
Qt-175b1689c9e173db62eb5612c7076531354e5252.tar.gz
Qt-175b1689c9e173db62eb5612c7076531354e5252.tar.bz2
clear abort flag when we start a new evaluate
Otherwise evaluate() would _always_ return the value previously passed to abortEvaluation(), once a script had been aborted.
-rw-r--r--src/script/api/qscriptengine.cpp1
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 179a49f..3378da9 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2150,6 +2150,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file
JSC::JSValue thisValue = d->thisForContext(exec);
JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSC::JSValue exceptionValue;
+ dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->setShouldAbort(false);
JSC::JSValue result = exec->interpreter()->execute(evalNode.get(), exec, thisObject, exec->scopeChain(), &exceptionValue);
if (dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->shouldAbort()) {
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index f7bac56..06be924 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -2536,6 +2536,13 @@ void tst_QScriptEngine::abortEvaluation()
eng.abortEvaluation();
QVERIFY(!eng.hasUncaughtException());
+ eng.abortEvaluation(123);
+ {
+ QScriptValue ret = eng.evaluate("'ciao'");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("ciao"));
+ }
+
EventReceiver3 receiver(&eng);
eng.setProcessEventsInterval(100);