| Index: third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp
|
| ===================================================================
|
| --- third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp (revision 9118)
|
| +++ third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp (working copy)
|
| @@ -24,7 +24,9 @@
|
| #include "DateMath.h"
|
| #include "DatePrototype.h"
|
| #include "FunctionPrototype.h"
|
| +#include "Interpreter.h"
|
| #include "JSArray.h"
|
| +#include "JSByteArray.h"
|
| #include "JSDOMBinding.h"
|
| #include "JSGlobalObject.h"
|
| #include "JSLock.h"
|
| @@ -95,7 +97,8 @@
|
| QObj,
|
| Object,
|
| Null,
|
| - RTArray
|
| + RTArray,
|
| + JSByteArray
|
| } JSRealType;
|
|
|
| #if defined(QTWK_RUNTIME_CONVERSION_DEBUG) || defined(QTWK_RUNTIME_MATCH_DEBUG)
|
| @@ -120,6 +123,8 @@
|
| return Boolean;
|
| else if (val.isNull())
|
| return Null;
|
| + else if (exec->interpreter()->isJSByteArray(val))
|
| + return JSByteArray;
|
| else if (val.isObject()) {
|
| JSObject *object = val.toObject(exec);
|
| if (object->inherits(&RuntimeArray::s_info)) // RuntimeArray 'inherits' from Array, but not in C++
|
| @@ -190,6 +195,9 @@
|
| case QObj:
|
| hint = QMetaType::QObjectStar;
|
| break;
|
| + case JSByteArray:
|
| + hint = QMetaType::QByteArray;
|
| + break;
|
| case Array:
|
| case RTArray:
|
| hint = QMetaType::QVariantList;
|
| @@ -425,12 +433,18 @@
|
| }
|
|
|
| case QMetaType::QByteArray: {
|
| - UString ustring = value.toString(exec);
|
| - ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()).toLatin1());
|
| - if (type == String)
|
| - dist = 5;
|
| - else
|
| - dist = 10;
|
| + if (type == JSByteArray) {
|
| + WTF::ByteArray* arr = asByteArray(value)->storage();
|
| + ret = QVariant(QByteArray(reinterpret_cast<const char*>(arr->data()), arr->length()));
|
| + dist = 0;
|
| + } else {
|
| + UString ustring = value.toString(exec);
|
| + ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()).toLatin1());
|
| + if (type == String)
|
| + dist = 5;
|
| + else
|
| + dist = 10;
|
| + }
|
| break;
|
| }
|
|
|
| @@ -822,9 +836,10 @@
|
| }
|
|
|
| if (type == QMetaType::QByteArray) {
|
| - QByteArray ba = variant.value<QByteArray>();
|
| - UString ustring(ba.constData());
|
| - return jsString(exec, ustring);
|
| + QByteArray qtByteArray = variant.value<QByteArray>();
|
| + WTF::RefPtr<WTF::ByteArray> wtfByteArray = WTF::ByteArray::create(qtByteArray.length());
|
| + qMemCopy(wtfByteArray->data(), qtByteArray.constData(), qtByteArray.length());
|
| + return new (exec) JSC::JSByteArray(exec, JSC::JSByteArray::createStructure(jsNull()), wtfByteArray.get());
|
| }
|
|
|
| if (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar) {
|
|
|