diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-03-01 08:43:48 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2011-03-01 09:21:49 (GMT) |
commit | 2699e8dae2b160f8d001459a7993b61fe4b1fac3 (patch) | |
tree | b049ef66379e511bed38cde106a3682b0d43548e /src/3rdparty | |
parent | 5c7b7f5fca8c557b14959ca338cb2fa62aea6aa0 (diff) | |
download | Qt-2699e8dae2b160f8d001459a7993b61fe4b1fac3.zip Qt-2699e8dae2b160f8d001459a7993b61fe4b1fac3.tar.gz Qt-2699e8dae2b160f8d001459a7993b61fe4b1fac3.tar.bz2 |
Don't assert in abortEvaluation() autotest
When QtScript is built without NDEBUG defined, the
tst_QScriptEngine::abortEvaluation() test would assert.
This was due to commit
716e0284c8f569d71e42354fd6fc3b965233e019, which fixed
the tst_QScriptEngine::throwErrorFromProcessEvents()
autotest for a script containing an infinite while-loop
with an empty body.
The CHECK_FOR_EXCEPTION_AT_END() that we added should only
be done if the timeout checker did not report a timeout;
otherwise the JSC state becomes corrupted due to
returnToThrowTrampoline() being called twice. This caused
an assert later when calculating the line number of the
exception.
Also add test cases for scripts with try-catch statements.
For abortEvaluation(), scripts should not be able to
observe (i.e. catch) the interrupted exception, but if
an error is thrown using QScriptContext::throwError(), the
script should be able to catch it.
Task-number: QTBUG-17854
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index b3c229e..d8027ff 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -1168,8 +1168,17 @@ DEFINE_STUB_FUNCTION(int, timeout_check) globalData->exception = createInterruptedExecutionException(globalData); VM_THROW_EXCEPTION_AT_END(); } - - CHECK_FOR_EXCEPTION_AT_END(); +#ifdef QT_BUILD_SCRIPT_LIB + else { + // It's possible that the call to QtScript's implementation of + // TimeoutChecker::didTimeOut() caused an error to be thrown. + // In that case, didTimeOut() should still return false, since + // we don't want the interrupted-exception to override the + // user-thrown error. But we need to check for exception here, + // otherwise JSC would continue normal execution. + CHECK_FOR_EXCEPTION_AT_END(); + } +#endif return timeoutChecker->ticksUntilNextCheck(); } |