diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-11-12 13:55:55 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-15 13:16:28 +0100 |
commit | 3dc7b5ddf6de5d9d000f443170d9a33e3d32bda3 (patch) | |
tree | bdf725cac352f9d83a6b8d7a4308c867ef2e20e0 /src/qml/qml | |
parent | cd6db04169dcd0f7b49f5875d3c63d94fa32e17a (diff) |
Cleanup exception catching code
Change-Id: I85afd5758f72e19c280dc196601ee145f0c25f01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 3 |
5 files changed, 8 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index a408072d38..33cffe6629 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1535,13 +1535,12 @@ void QV4::QmlIncubatorObject::statusChanged(QQmlIncubator::Status s) QV4::ScopedFunctionObject f(scope, d()->statusChanged); if (f) { - QV4::ExecutionContext *ctx = scope.engine->currentContext(); QV4::ScopedCallData callData(scope, 1); callData->thisObject = this; callData->args[0] = QV4::Primitive::fromUInt32(s); f->call(callData); if (scope.hasException()) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = scope.engine->catchExceptionAsQmlError(); QQmlEnginePrivate::warning(QQmlEnginePrivate::get(d()->v8->engine()), error); } } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 7425509b40..55fc193abd 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -78,7 +78,7 @@ void QQmlDelayedError::setErrorObject(QObject *object) void QQmlDelayedError::catchJavaScriptException(QV4::ExecutionContext *context) { - m_error = QV4::ExecutionEngine::catchExceptionAsQmlError(context); + m_error = context->engine()->catchExceptionAsQmlError(); } @@ -158,7 +158,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, result = function->asFunctionObject()->call(callData); if (scope.hasException()) { if (watcher.wasDeleted()) - ctx->catchException(); // ignore exception + scope.engine->catchException(); // ignore exception else delayedError()->catchJavaScriptException(ctx); if (isUndefined) @@ -288,7 +288,6 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); - QV4::ExecutionContext *ctx = v4->currentContext(); QV4::Scope scope(v4); QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, scopeObject)); @@ -298,7 +297,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje if (!v4->hasException) result = script.run(); if (v4->hasException) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = v4->catchExceptionAsQmlError(); if (error.description().isEmpty()) error.setDescription(QLatin1String("Exception occurred during function evaluation")); if (error.line() == -1) @@ -322,7 +321,6 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); - QV4::ExecutionContext *ctx = v4->currentContext(); QV4::Scope scope(v4); QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, qmlScope)); @@ -332,7 +330,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q if (!v4->hasException) result = script.qmlBinding(); if (v4->hasException) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = v4->catchExceptionAsQmlError(); if (error.description().isEmpty()) error.setDescription(QLatin1String("Exception occurred during function evaluation")); if (error.line() == -1) diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1b222fe1a3..bfdf862c7b 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2638,11 +2638,10 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v8engine, ctxt, 0)); QV4::QmlContextWrapper::takeContextOwnership(qmlglobal); - QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->currentContext(); m_program->qml = qmlglobal; m_program->run(); if (scope.engine->hasException) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = scope.engine->catchExceptionAsQmlError(); if (error.isValid()) ep->warning(error); } diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index f6d72c00b1..622e05fe7c 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -948,10 +948,9 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) callData->args[ii] = ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1]); QV4::ScopedValue result(scope); - QV4::ExecutionContext *ctx = function->engine()->currentContext(); result = function->call(callData); if (scope.hasException()) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = scope.engine->catchExceptionAsQmlError(); if (error.isValid()) ep->warning(error); if (a[0]) *(QVariant *)a[0] = QVariant(); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 1566971827..9b1607c7ad 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1592,10 +1592,9 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me) void QQmlXMLHttpRequest::dispatchCallback(const ValueRef me) { - ExecutionContext *ctx = v4->currentContext(); dispatchCallbackImpl(me); if (v4->hasException) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + QQmlError error = v4->catchExceptionAsQmlError(); QQmlEnginePrivate::warning(QQmlEnginePrivate::get(v4->v8Engine->engine()), error); } } |