aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvme.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-20 23:51:45 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-21 10:11:43 +0200
commit7fe54ee6d6eb44c630038229eb9a4bb1780eec77 (patch)
tree20e0278387688936a060eaed33273ca7bb5e89c5 /src/qml/qml/qqmlvme.cpp
parente1a6612d3a4528fee8854c274232fc4966d65237 (diff)
Convert the remaining TryCatch statements to use QV4::Exception
v8::Script::Run doesn't catch the exception anymore. Instead we handle this on the calling side, removing all needs for v8::TryCatch. Change-Id: I946269a6734f50c728c4f153c00cd19db48f1a6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r--src/qml/qml/qqmlvme.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index fa56756c91..af4394b44b 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -1165,7 +1165,7 @@ void QQmlScriptData::initialize(QQmlEngine *engine)
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV8Engine *v8engine = ep->v8engine();
- // If compilation throws an error, a surrounding v8::TryCatch will record it.
+ // If compilation throws an error, a surrounding catch will record it.
v8::Handle<v8::Script> program = v8engine->qmlModeCompile(m_programSource.constData(),
m_programSource.length(), urlString, 1);
if (program.IsEmpty())
@@ -1235,27 +1235,20 @@ QV4::PersistentValue QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptData *s
ctxt->importedScripts << run(ctxt, script->scripts.at(ii)->scriptData());
}
- v8::TryCatch try_catch;
if (!script->isInitialized())
script->initialize(parentCtxt->engine);
v8::Handle<v8::Object> qmlglobal = v8engine->qmlScope(ctxt, 0);
v8engine->contextWrapper()->takeContextOwnership(qmlglobal);
- if (!!script->m_program) {
+ QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->current;
+ try {
script->m_program->Run(qmlglobal);
- } else {
- // Compilation failed.
- Q_ASSERT(try_catch.HasCaught());
- }
-
- if (try_catch.HasCaught()) {
- v8::Handle<v8::Message> message = try_catch.Message();
- if (!message.IsEmpty()) {
- QQmlError error;
- QQmlExpressionPrivate::exceptionToError(message, error);
+ } catch (QV4::Exception &e) {
+ QQmlError error;
+ QQmlExpressionPrivate::exceptionToError(e, error);
+ if (error.isValid())
ep->warning(error);
- }
}
rv = qmlglobal->v4Value();