Showing the changes to libraries/script-engine/src/XMLHttpRequestClass.cpp (1 of 2 files). Show all
Unified · Split
| @@ -194,10 +194,10 @@ void XMLHttpRequestClass::open(const QString& method, const QString& url, bool a · 193 unmodified lines | ||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | void XMLHttpRequestClass::send() { |
| 197 | − send(QString::Null()); | |
| 197 | + send(QString()); | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | −void XMLHttpRequestClass::send(const QString& data) { | |
| 200 | +void XMLHttpRequestClass::send(const QVariant& data) { | |
| 201 | 201 | if (_readyState == OPENED && !_reply) { |
| 202 | 202 | if (!data.isNull()) { |
| 203 | 203 | if (_url.isLocalFile()) { |
| @@ -205,7 +205,12 @@ void XMLHttpRequestClass::send(const QString& data) { · 1 unmodified line | ||
| 205 | 205 | return; |
| 206 | 206 | } else { |
| 207 | 207 | _sendData = new QBuffer(this); |
| 208 | − _sendData->setData(data.toUtf8()); | |
| 208 | + if (_responseType == "arraybuffer") { | |
| 209 | + QByteArray ba = qvariant_cast<QByteArray>(data); | |
| 210 | + _sendData->setData(ba); | |
| 211 | + } else { | |
| 212 | + _sendData->setData(data.toString().toUtf8()); | |
| 213 | + } | |
| 209 | 214 | } |
| 210 | 215 | } |
| 211 | 216 | |
| @@ -274,7 +279,7 @@ void XMLHttpRequestClass::requestFinished() { · 62 unmodified lines | ||
| 274 | 279 | _responseData = QScriptValue::NullValue; |
| 275 | 280 | } |
| 276 | 281 | } else if (_responseType == "arraybuffer") { |
| 277 | − _responseData = QScriptValue(_rawResponseData.data()); | |
| 282 | + _responseData = _engine->newVariant(QVariant::fromValue(_rawResponseData)); | |
| 278 | 283 | } else { |
| 279 | 284 | _responseData = QScriptValue(QString(_rawResponseData.data())); |
| 280 | 285 | } |