summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJedrzej Nowacki <jedrzej.nowacki@nokia.com>2010-09-30 11:17:39 (GMT)
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 10:07:01 (GMT)
commitf955d645ff3804aa8544f94d02175deec7a0d873 (patch)
tree786215c7cc684d1e411574c7c9fbecaa4b0eb167 /src
parentd0be1ef82ecd3ab6a8195fd9bceeecfa470877f9 (diff)
downloadQt-f955d645ff3804aa8544f94d02175deec7a0d873.zip
Qt-f955d645ff3804aa8544f94d02175deec7a0d873.tar.gz
Qt-f955d645ff3804aa8544f94d02175deec7a0d873.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 (cherry picked from commit eb407209bb9f2c06684fd1299169cd3b8ab4b58d)
Diffstat (limited to 'src')
-rw-r--r--src/script/api/qscriptengine.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index f44f33d..91c06f6 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -49,6 +49,7 @@
#include "DateConstructor.h"
#include "RegExpConstructor.h"
+#include "ExceptionHelpers.h"
#include "PrototypeFunction.h"
#include "InitializeThreading.h"
#include "ObjectPrototype.h"
@@ -3547,9 +3548,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