diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-09-30 11:17:39 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-09-30 12:46:02 (GMT) |
commit | eb407209bb9f2c06684fd1299169cd3b8ab4b58d (patch) | |
tree | 8ec3f3a53f37fb56b8a72f68dab0d03b5af931b1 /src/script/api | |
parent | fc50d7ecaacfbfef1dbefd6ffdc083cb66c5633c (diff) | |
download | Qt-eb407209bb9f2c06684fd1299169cd3b8ab4b58d.zip Qt-eb407209bb9f2c06684fd1299169cd3b8ab4b58d.tar.gz Qt-eb407209bb9f2c06684fd1299169cd3b8ab4b58d.tar.bz2 |
Fix QScriptEngine::abortEvaluation.
This patch reduce time in which QScriptEngine would abort an script
executing multiple long-running native functions.
Task-number: QTBUG-9433
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 07aced4..128e9c3 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -46,6 +46,7 @@ #include "Error.h" #include "Interpreter.h" +#include "ExceptionHelpers.h" #include "PrototypeFunction.h" #include "InitializeThreading.h" #include "ObjectPrototype.h" @@ -4116,9 +4117,11 @@ bool QScriptEngine::isEvaluating() const void QScriptEngine::abortEvaluation(const QScriptValue &result) { Q_D(QScriptEngine); - - d->timeoutChecker()->setShouldAbort(true); + if (!isEvaluating()) + return; d->abortResult = result; + d->timeoutChecker()->setShouldAbort(true); + JSC::throwError(d->currentFrame, JSC::createInterruptedExecutionException(&d->currentFrame->globalData()).toObject(d->currentFrame)); } #ifndef QT_NO_QOBJECT |