From: Simon Hausmann Date: Wed, 12 Jun 2013 08:18:21 +0000 (+0200) Subject: Fix this object in constructor callbacks through the v8 compatibility layer X-Git-Tag: upstream/5.2.1~669^2~262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=760eaf106c8bda7a7797b32cda854d079fde58d5;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- 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);