aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qquickworkerscript.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-09-01 11:48:15 +0200
committerLars Knoll <lars.knoll@qt.io>2017-09-02 07:12:17 +0000
commit74c8fe86755af485f8d0a47799d6d50f00070f05 (patch)
tree9e3d8c51d46d9f0fa2555cc77d184d6b3ee1be7d /src/qml/types/qquickworkerscript.cpp
parenta91383545c6f487cff61f401d11f1e85939222e9 (diff)
Always set the correct FunctionObject when calling JS functions
Renamed ScopedCallData to JSCall, enforced passing a JS FunctionObject to it, and added call() and callAsConstructor() methods to it. Change-Id: I30db65c9765c2896b5909fe2105c0934c6dad861 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types/qquickworkerscript.cpp')
-rw-r--r--src/qml/types/qquickworkerscript.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index a26bd81c8b..6df15c2513 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -248,10 +248,10 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage")));
QV4::ScopedValue function(scope, QV4::BuiltinFunction::create(globalContext, name,
QQuickWorkerScriptEnginePrivate::method_sendMessage));
- QV4::ScopedCallData callData(scope, 1);
- callData->args[0] = function;
- callData->thisObject = global();
- createsend.set(scope.engine, createsendconstructor->call(callData));
+ QV4::JSCall jsCall(scope, createsendconstructor, 1);
+ jsCall->args[0] = function;
+ jsCall->thisObject = global();
+ createsend.set(scope.engine, jsCall.call());
}
// Requires handle and context scope
@@ -265,10 +265,10 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i
QV4::ScopedFunctionObject f(scope, createsend.value());
QV4::ScopedValue v(scope);
- QV4::ScopedCallData callData(scope, 1);
- callData->args[0] = QV4::Primitive::fromInt32(id);
- callData->thisObject = global();
- v = f->call(callData);
+ QV4::JSCall jsCall(scope, f, 1);
+ jsCall->args[0] = QV4::Primitive::fromInt32(id);
+ jsCall->thisObject = global();
+ v = jsCall.call();
if (scope.hasException())
v = scope.engine->catchException();
return v->asReturnedValue();
@@ -366,11 +366,11 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
QV4::Scoped<QV4::QmlContext> qmlContext(scope, script->qmlContext.value());
Q_ASSERT(!!qmlContext);
- QV4::ScopedCallData callData(scope, 2);
- callData->thisObject = workerEngine->global();
- callData->args[0] = qmlContext->d()->qml(); // ###
- callData->args[1] = value;
- f->call(callData);
+ QV4::JSCall jsCall(scope, f, 2);
+ jsCall->thisObject = workerEngine->global();
+ jsCall->args[0] = qmlContext->d()->qml(); // ###
+ jsCall->args[1] = value;
+ jsCall.call();
if (scope.hasException()) {
QQmlError error = scope.engine->catchExceptionAsQmlError();
reportScriptException(script, error);