diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-10-19 10:40:38 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-10-19 11:40:35 (GMT) |
commit | 7a647e8c9efbbd46184bc4714159c82ae26be958 (patch) | |
tree | 1334c6e793b3cc84c669bbb78b1de26a1574ed18 /src/script/api/qscriptengine.cpp | |
parent | f9e46cdb2d9a42d52f90fe50a53a76c03065b9ce (diff) | |
download | Qt-7a647e8c9efbbd46184bc4714159c82ae26be958.zip Qt-7a647e8c9efbbd46184bc4714159c82ae26be958.tar.gz Qt-7a647e8c9efbbd46184bc4714159c82ae26be958.tar.bz2 |
Regression fix. Fix the hasUncaughtException() flag in debugger's event.
The QScriptEngine::hasUncaughtException() flag should be set to true if
returning from a JS function was caused by an exception. According to
documentation, the flag had to be accessible from the
QScriptEngineAgent::functionExit event.
New autotest was added.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b1f36be..360036a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2164,7 +2164,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file if (debugger) debugger->evaluateStart(sourceId); - exec->clearException(); + clearExceptions(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); JSC::EvalExecutable executable(exec, source); @@ -2381,7 +2381,7 @@ bool QScriptEngine::hasUncaughtException() const { Q_D(const QScriptEngine); JSC::ExecState* exec = d->globalExec(); - return exec->hadException(); + return exec->hadException() || d->currentException().isValid(); } /*! @@ -2398,8 +2398,13 @@ bool QScriptEngine::hasUncaughtException() const QScriptValue QScriptEngine::uncaughtException() const { Q_D(const QScriptEngine); + QScriptValue result; JSC::ExecState* exec = d->globalExec(); - return const_cast<QScriptEnginePrivate*>(d)->scriptValueFromJSCValue(exec->exception()); + if (exec->hadException()) + result = const_cast<QScriptEnginePrivate*>(d)->scriptValueFromJSCValue(exec->exception()); + else + result = d->currentException(); + return result; } /*! @@ -2452,6 +2457,7 @@ void QScriptEngine::clearExceptions() Q_D(QScriptEngine); JSC::ExecState* exec = d->currentFrame; exec->clearException(); + d->clearCurrentException(); } /*! |