Fix mapping of JS objects/arrays to C++
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 10 Sep 2014 15:13:10 +0000 (17:13 +0200)
committerLars Knoll <lars.knoll@digia.com>
Wed, 17 Sep 2014 06:13:11 +0000 (08:13 +0200)
commit3dbe05f6bf3fd51ce8097c35f6c7f12b39acb0f6
tree444ed433aa02085357b589b19b28f4bc1c243320
parentcfe1a8152c948a4586ffa1fe79b47f9a0e88beb5
Fix mapping of JS objects/arrays to C++

[ChangeLog][QtQml][Important Behavior Changes] When a JavaScript object/array
is passed to C++ through a QVariant, the engine no longer immediately converts
the object recursively into a QVariantMap or QVariantList but instead stores
a QJSValue in the QVariant. This prevents a loss of data when the JS object
contains non-primitive types such as function objects for example. Code that
expects the variant type to be exactly QVariant::Map or QVariant::List may
need to be adapted. Registered conversion functions however ensure that code
that merely calls toMap() or toList() continues to work.

Task-number: QTBUG-40431
Change-Id: I1dbc1d5f8e78ad28bb62db3681b9a0b34557e7f5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
16 files changed:
src/qml/debugger/qqmlenginedebugservice.cpp
src/qml/debugger/qqmlenginedebugservice_p.h
src/qml/jsapi/qjsengine.cpp
src/qml/jsapi/qjsvalue.cpp
src/qml/jsapi/qjsvalue_p.h
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/qml/jsruntime/qv4variantobject.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/qml/v8/qv8engine_p.h
src/qml/types/qqmllistmodel.cpp
src/qml/util/qqmllistaccessor.cpp
tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp