OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // If we errored out or got no data, we still return a blob, just an emp
ty one. | 300 // If we errored out or got no data, we still return a blob, just an emp
ty one. |
301 size_t size = 0; | 301 size_t size = 0; |
302 if (m_binaryResponseBuilder) { | 302 if (m_binaryResponseBuilder) { |
303 RefPtr<RawData> rawData = RawData::create(); | 303 RefPtr<RawData> rawData = RawData::create(); |
304 size = m_binaryResponseBuilder->size(); | 304 size = m_binaryResponseBuilder->size(); |
305 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size
); | 305 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size
); |
306 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile); | 306 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile); |
307 blobData->setContentType(responseMIMEType()); // responseMIMEType de
faults to text/xml which may be incorrect. | 307 blobData->setContentType(responseMIMEType()); // responseMIMEType de
faults to text/xml which may be incorrect. |
308 m_binaryResponseBuilder.clear(); | 308 m_binaryResponseBuilder.clear(); |
309 } | 309 } |
310 m_responseBlob = Blob::create(blobData.release(), size); | 310 m_responseBlob = Blob::create(BlobDataHandle::create(blobData.release(),
size)); |
311 } | 311 } |
312 | 312 |
313 return m_responseBlob.get(); | 313 return m_responseBlob.get(); |
314 } | 314 } |
315 | 315 |
316 ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec) | 316 ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec) |
317 { | 317 { |
318 if (m_responseTypeCode != ResponseTypeArrayBuffer) { | 318 if (m_responseTypeCode != ResponseTypeArrayBuffer) { |
319 ec = INVALID_STATE_ERR; | 319 ec = INVALID_STATE_ERR; |
320 return 0; | 320 return 0; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return; | 643 return; |
644 | 644 |
645 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily(
)) { | 645 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily(
)) { |
646 // FIXME: Should we set a Content-Type if one is not set. | 646 // FIXME: Should we set a Content-Type if one is not set. |
647 // FIXME: add support for uploading bundles. | 647 // FIXME: add support for uploading bundles. |
648 m_requestEntityBody = FormData::create(); | 648 m_requestEntityBody = FormData::create(); |
649 if (body->isFile()) | 649 if (body->isFile()) |
650 m_requestEntityBody->appendFile(toFile(body)->path()); | 650 m_requestEntityBody->appendFile(toFile(body)->path()); |
651 #if ENABLE(BLOB) | 651 #if ENABLE(BLOB) |
652 else | 652 else |
653 m_requestEntityBody->appendBlob(body->url()); | 653 m_requestEntityBody->appendBlob(body->uuid(), body->blobDataHandle()
); |
654 #endif | 654 #endif |
655 } | 655 } |
656 | 656 |
657 createRequest(ec); | 657 createRequest(ec); |
658 } | 658 } |
659 | 659 |
660 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) | 660 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) |
661 { | 661 { |
662 if (!initSend(ec)) | 662 if (!initSend(ec)) |
663 return; | 663 return; |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 info.addMember(m_responseDocument); | 1318 info.addMember(m_responseDocument); |
1319 info.addMember(m_binaryResponseBuilder); | 1319 info.addMember(m_binaryResponseBuilder); |
1320 info.addMember(m_responseArrayBuffer); | 1320 info.addMember(m_responseArrayBuffer); |
1321 info.addMember(m_lastSendURL); | 1321 info.addMember(m_lastSendURL); |
1322 info.addMember(m_eventTargetData); | 1322 info.addMember(m_eventTargetData); |
1323 info.addMember(m_progressEventThrottle); | 1323 info.addMember(m_progressEventThrottle); |
1324 info.addMember(m_securityOrigin); | 1324 info.addMember(m_securityOrigin); |
1325 } | 1325 } |
1326 | 1326 |
1327 } // namespace WebCore | 1327 } // namespace WebCore |
OLD | NEW |