From 760eaf106c8bda7a7797b32cda854d079fde58d5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Jun 2013 10:18:21 +0200 Subject: [PATCH] Fix this object in constructor callbacks through the v8 compatibility layer Make sure that the thisObject is set, so that the XHR constructor can set an external resource correctly. Change-Id: Id217247cafcee42806dd75b5f461df87c296b81b Reviewed-by: Lars Knoll --- src/qml/qml/v4/qv4v8.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qml/qml/v4/qv4v8.cpp b/src/qml/qml/v4/qv4v8.cpp index a507560..0542e1c 100644 --- a/src/qml/qml/v4/qv4v8.cpp +++ b/src/qml/qml/v4/qv4v8.cpp @@ -1163,13 +1163,14 @@ protected: static QV4::Value construct(QV4::Managed *m, ExecutionContext *context, QV4::Value *args, int argc) { V4V8Function *that = static_cast(m); - Arguments arguments(args, argc, QV4::Value::undefinedValue(), true, that->m_functionTemplate->m_data.value()); QV4::Object *obj = that->m_functionTemplate->InstanceTemplate()->NewInstance()->v4Value().asObject(); QV4::Value proto = that->Managed::get(context, context->engine->id_prototype); if (proto.isObject()) obj->prototype = proto.objectValue(); + Arguments arguments(args, argc, QV4::Value::fromObject(obj), true, that->m_functionTemplate->m_data.value()); + QV4::Value result = QV4::Value::undefinedValue(); if (that->m_functionTemplate->m_callback) result = that->m_functionTemplate->m_callback(arguments); -- 2.7.4