diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 16:13:21 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 16:39:10 (GMT) |
commit | a8dae30f3825d0527a38499e13bd8e36485aac47 (patch) | |
tree | 0f42ae104da8a59d3f50e277b83ac29750610c40 /src/script/api/qscriptvalue.cpp | |
parent | da769c4d4bd890e98173baf406f5455052f09c1f (diff) | |
download | Qt-a8dae30f3825d0527a38499e13bd8e36485aac47.zip Qt-a8dae30f3825d0527a38499e13bd8e36485aac47.tar.gz Qt-a8dae30f3825d0527a38499e13bd8e36485aac47.tar.bz2 |
Remove the uncaughtException, use the JSC exception instead
Use the exception from JSC::exec instead of
QScriptEngin::uncaughtException.
A few more tests are passing for qscriptvalue and qscriptqobject.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 1082fa3..7693af8 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -401,7 +401,7 @@ void QScriptValuePrivate::saveException(JSC::ExecState *exec, JSC::JSValue *val) void QScriptValuePrivate::restoreException(JSC::ExecState *exec, JSC::JSValue val) { - if (exec && !exec->hadException() && val) + if (exec && val) exec->setException(val); } @@ -1244,16 +1244,15 @@ QString QScriptValue::toString() const JSC::JSValue savedException; QScriptValuePrivate::saveException(exec, &savedException); JSC::UString str = d->jscValue.toString(exec); - if (exec && exec->hadException()) { + if (exec && exec->hadException() && !str.size()) { JSC::JSValue savedException2; QScriptValuePrivate::saveException(exec, &savedException2); - if (!str.size()) - str = savedException2.toString(exec); - if (!eng_p->uncaughtException) - eng_p->uncaughtException = savedException2; + str = savedException2.toString(exec); + QScriptValuePrivate::restoreException(exec, savedException2); } - QScriptValuePrivate::restoreException(exec, savedException); - return QString(reinterpret_cast<const QChar*>(str.data()), str.size()); + if (savedException) + QScriptValuePrivate::restoreException(exec, savedException); + return QScript::qtStringFromJSCUString(str); } case QScriptValuePrivate::Number: return QScript::qtStringFromJSCUString(JSC::UString::from(d->numberValue)); @@ -2009,8 +2008,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, QScriptValuePrivate::saveException(exec, &savedException); JSC::JSValue result = JSC::call(exec, callee, callType, callData, jscThisObject, jscArgs); if (exec->hadException()) { - if (!eng_p->uncaughtException) - eng_p->uncaughtException = exec->exception(); result = exec->exception(); } else { QScriptValuePrivate::restoreException(exec, savedException); @@ -2090,8 +2087,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, QScriptValuePrivate::saveException(exec, &savedException); JSC::JSValue result = JSC::call(exec, callee, callType, callData, jscThisObject, applyArgs); if (exec->hadException()) { - if (!eng_p->uncaughtException) - eng_p->uncaughtException = exec->exception(); result = exec->exception(); } else { QScriptValuePrivate::restoreException(exec, savedException); @@ -2142,8 +2137,6 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) QScriptValuePrivate::saveException(exec, &savedException); JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, jscArgs); if (exec->hadException()) { - if (!eng_p->uncaughtException) - eng_p->uncaughtException = exec->exception(); result = JSC::asObject(exec->exception()); } else { QScriptValuePrivate::restoreException(exec, savedException); @@ -2201,8 +2194,6 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) QScriptValuePrivate::saveException(exec, &savedException); JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, applyArgs); if (exec->hadException()) { - if (!eng_p->uncaughtException) - eng_p->uncaughtException = exec->exception(); if (exec->exception().isObject()) result = JSC::asObject(exec->exception()); } else { |