aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-17 08:56:51 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-19 14:59:11 +0200
commit9fd4591a61df467362fa2f17cc2d506efd6bece3 (patch)
treefa3c31cffcd67943ae26823ab9d2b8370815980f /src/qml
parentf0eaaef4aeb6fa8951cca1e1e90def3411896e9f (diff)
Remove internal method from public API
QQmlError is public API and shouldn't expose an internal method. Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp22
-rw-r--r--src/qml/jsruntime/qv4engine_p.h4
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlerror.cpp22
-rw-r--r--src/qml/qml/qqmlerror.h7
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp6
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp2
-rw-r--r--src/qml/types/qquickworkerscript.cpp4
11 files changed, 36 insertions, 39 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index d312db272c..2c68c4f400 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -840,6 +840,28 @@ ReturnedValue ExecutionEngine::catchException(ExecutionContext *catchingContext,
return res;
}
+QQmlError ExecutionEngine::convertJavaScriptException(ExecutionContext *context)
+{
+ QV4::StackTrace trace;
+ QV4::Scope scope(context);
+ QV4::ScopedValue exception(scope, context->catchException(&trace));
+ QQmlError error;
+ if (!trace.isEmpty()) {
+ QV4::StackFrame frame = trace.first();
+ error.setUrl(QUrl(frame.source));
+ error.setLine(frame.line);
+ error.setColumn(frame.column);
+ }
+ QV4::Scoped<QV4::ErrorObject> errorObj(scope, exception);
+ if (!!errorObj && errorObj->asSyntaxError()) {
+ QV4::ScopedString m(scope, errorObj->engine()->newString("message"));
+ QV4::ScopedValue v(scope, errorObj->get(m));
+ error.setDescription(v->toQStringNoThrow());
+ } else
+ error.setDescription(exception->toQStringNoThrow());
+ return error;
+}
+
#if !defined(V4_CXX_ABI_EXCEPTION)
struct DummyException
{};
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index e49b6a4ebf..24fb4ad923 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -56,6 +56,7 @@ class PageAllocation;
QT_BEGIN_NAMESPACE
class QV8Engine;
+class QQmlError;
namespace QV4 {
namespace Debugging {
@@ -328,6 +329,9 @@ struct Q_QML_EXPORT ExecutionEngine
void Q_NORETURN throwException(const ValueRef value);
ReturnedValue catchException(ExecutionContext *catchingContext, StackTrace *trace);
+ // Use only inside catch(...) -- will re-throw if no JS exception
+ static QQmlError convertJavaScriptException(QV4::ExecutionContext *context);
+
void Q_NORETURN throwInternal();
// ----
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index c4566fe2a3..3bca862bb7 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -727,7 +727,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
try {
f->call(callData);
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
if (error.description().isEmpty())
error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(f->name->toQString()));
QQmlEnginePrivate::get(v4->v8Engine->engine())->warning(error);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 6d194a6ba8..ab08fb78e3 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1573,7 +1573,7 @@ void QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
callData->args[0] = QV4::Primitive::fromUInt32(s);
f->call(callData);
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
QQmlEnginePrivate::warning(QQmlEnginePrivate::get(v8->engine()), error);
}
}
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 3a4179717a..ad95ecdf06 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -138,28 +138,6 @@ QQmlError::~QQmlError()
delete d; d = 0;
}
-QQmlError QQmlError::catchJavaScriptException(QV4::ExecutionContext *context)
-{
- QV4::StackTrace trace;
- QV4::Scope scope(context);
- QV4::ScopedValue exception(scope, context->catchException(&trace));
- QQmlError error;
- if (!trace.isEmpty()) {
- QV4::StackFrame frame = trace.first();
- error.setUrl(QUrl(frame.source));
- error.setLine(frame.line);
- error.setColumn(frame.column);
- }
- QV4::Scoped<QV4::ErrorObject> errorObj(scope, exception);
- if (!!errorObj && errorObj->asSyntaxError()) {
- QV4::ScopedString m(scope, errorObj->engine()->newString("message"));
- QV4::ScopedValue v(scope, errorObj->get(m));
- error.setDescription(v->toQStringNoThrow());
- } else
- error.setDescription(exception->toQStringNoThrow());
- return error;
-}
-
/*!
Returns true if this error is valid, otherwise false.
*/
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index 50491b911c..e69b3c15ba 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -49,10 +49,6 @@
QT_BEGIN_NAMESPACE
-namespace QV4 {
-struct ExecutionContext;
-}
-
class QDebug;
class QQmlErrorPrivate;
class Q_QML_EXPORT QQmlError
@@ -63,9 +59,6 @@ public:
QQmlError &operator=(const QQmlError &);
~QQmlError();
- // Use only inside catch(...) -- will re-throw if no JS exception
- static QQmlError catchJavaScriptException(QV4::ExecutionContext *context);
-
bool isValid() const;
QUrl url() const;
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 8751d9c500..37a9e398f8 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -86,7 +86,7 @@ void QQmlDelayedError::setErrorObject(QObject *object)
void QQmlDelayedError::catchJavaScriptException(QV4::ExecutionContext *context)
{
- m_error = QQmlError::catchJavaScriptException(context);
+ m_error = QV4::ExecutionEngine::convertJavaScriptException(context);
}
@@ -306,7 +306,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje
script.parse();
result = script.run();
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
if (error.description().isEmpty())
error.setDescription(QLatin1String("Exception occurred during function evaluation"));
if (error.line() == -1)
@@ -340,7 +340,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q
script.parse();
result = script.qmlBinding();
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
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 5f733caf51..932faf4b88 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2767,7 +2767,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
m_program->qml = qmlglobal;
m_program->run();
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
if (error.isValid())
ep->warning(error);
}
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 915314e322..5752033744 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -960,7 +960,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
result = function->call(callData);
if (a[0]) *(QVariant *)a[0] = ep->v8engine()->toVariant(result, 0);
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
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 7a251601db..aff0cf2b59 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1572,7 +1572,7 @@ void QQmlXMLHttpRequest::dispatchCallback(const ValueRef me)
// the source is changed). We do nothing in this case, as the evaluation
// cannot succeed.
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
QQmlEnginePrivate::warning(QQmlEnginePrivate::get(v4->v8Engine->engine()), error);
}
}
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 9b8616d5e7..322b4b8df0 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -367,7 +367,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
callData->args[1] = value;
f->call(callData);
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
reportScriptException(script, error);
}
}
@@ -404,7 +404,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
program.parse();
program.run();
} catch (...) {
- QQmlError error = QQmlError::catchJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
reportScriptException(script, error);
}
} else {