diff options
author | Valery Kotov <kotov.valery@gmail.com> | 2015-03-04 21:57:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-03-09 19:41:41 +0000 |
commit | d988310434b00cc0e159fdf6ff3f586eefc47eed (patch) | |
tree | 6dd1bdfb543a3ca8a2a1d0c51273b1e6a9fe5bb8 /src/qml/jsruntime | |
parent | 0294702c9c174c67de563cfdea5c32548d111a58 (diff) |
QML Engine: ArrayBuffer XHR response type support
Support for "arraybuffer" response type for QQmlXMLHttpRequest was
added.
[ChangeLog][QtQml][QQmlXMLHttpRequest] QQmlXMLHttpRequest now
supports "arraybuffer" binary response type.
Change-Id: I866e543cc7bc6ab037ffff1ef6628057b73daf90
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 2c8a68812a..54dd5979cf 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -582,6 +582,16 @@ Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *ic, Object *pr return object->d(); } +Heap::ArrayBuffer *ExecutionEngine::newArrayBuffer(const QByteArray &array) +{ + Scope scope(this); + Scoped<ArrayBuffer> object(scope, memoryManager->alloc<ArrayBuffer>(this, array.size())); + if (!hasException) { + memcpy(object->d()->data->data(), array.data(), array.size()); + } + return object->d(); +} + Heap::DateObject *ExecutionEngine::newDateObject(const Value &value) { diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 098510e91a..bcb74ab694 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -268,6 +268,8 @@ public: Heap::ArrayObject *newArrayObject(const QStringList &list); Heap::ArrayObject *newArrayObject(InternalClass *ic, Object *prototype); + Heap::ArrayBuffer *newArrayBuffer(const QByteArray &array); + Heap::DateObject *newDateObject(const Value &value); Heap::DateObject *newDateObject(const QDateTime &dt); |