| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() | 355 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() |
| 356 { | 356 { |
| 357 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); | 357 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); |
| 358 | 358 |
| 359 if (m_error || m_state != DONE) | 359 if (m_error || m_state != DONE) |
| 360 return nullptr; | 360 return nullptr; |
| 361 | 361 |
| 362 if (!m_responseArrayBuffer) { | 362 if (!m_responseArrayBuffer) { |
| 363 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { | 363 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { |
| 364 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitialized(
m_binaryResponseBuilder->size(), 1); | 364 DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitialized(m_binar
yResponseBuilder->size(), 1); |
| 365 if (!m_binaryResponseBuilder->getAsBytes(buffer->data(), static_cast
<size_t>(buffer->byteLength()))) { | 365 if (!m_binaryResponseBuilder->getAsBytes(buffer->data(), static_cast
<size_t>(buffer->byteLength()))) { |
| 366 // m_binaryResponseBuilder failed to allocate an ArrayBuffer. | 366 // m_binaryResponseBuilder failed to allocate an ArrayBuffer. |
| 367 // We need to crash the renderer since there's no way defined in | 367 // We need to crash the renderer since there's no way defined in |
| 368 // the spec to tell this to the user. | 368 // the spec to tell this to the user. |
| 369 CRASH(); | 369 CRASH(); |
| 370 } | 370 } |
| 371 m_responseArrayBuffer = buffer.release(); | 371 m_responseArrayBuffer = buffer; |
| 372 m_binaryResponseBuilder.clear(); | 372 m_binaryResponseBuilder.clear(); |
| 373 } else { | 373 } else { |
| 374 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0); | 374 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 return m_responseArrayBuffer.get(); | 378 return m_responseArrayBuffer.get(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 Stream* XMLHttpRequest::responseLegacyStream() | 381 Stream* XMLHttpRequest::responseLegacyStream() |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrSt
ringOrFormData& body, ExceptionState& exceptionState) | 645 void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrSt
ringOrFormData& body, ExceptionState& exceptionState) |
| 646 { | 646 { |
| 647 InspectorInstrumentation::willSendXMLHttpRequest(getExecutionContext(), url(
)); | 647 InspectorInstrumentation::willSendXMLHttpRequest(getExecutionContext(), url(
)); |
| 648 | 648 |
| 649 if (body.isNull()) { | 649 if (body.isNull()) { |
| 650 send(String(), exceptionState); | 650 send(String(), exceptionState); |
| 651 return; | 651 return; |
| 652 } | 652 } |
| 653 | 653 |
| 654 if (body.isArrayBuffer()) { | 654 if (body.isArrayBuffer()) { |
| 655 send(body.getAsArrayBuffer().get(), exceptionState); | 655 send(body.getAsArrayBuffer(), exceptionState); |
| 656 return; | 656 return; |
| 657 } | 657 } |
| 658 | 658 |
| 659 if (body.isArrayBufferView()) { | 659 if (body.isArrayBufferView()) { |
| 660 send(body.getAsArrayBufferView().get(), exceptionState); | 660 send(body.getAsArrayBufferView(), exceptionState); |
| 661 return; | 661 return; |
| 662 } | 662 } |
| 663 | 663 |
| 664 if (body.isBlob()) { | 664 if (body.isBlob()) { |
| 665 send(body.getAsBlob(), exceptionState); | 665 send(body.getAsBlob(), exceptionState); |
| 666 return; | 666 return; |
| 667 } | 667 } |
| 668 | 668 |
| 669 if (body.isDocument()) { | 669 if (body.isDocument()) { |
| 670 send(body.getAsDocument(), exceptionState); | 670 send(body.getAsDocument(), exceptionState); |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 { | 1694 { |
| 1695 return ActiveDOMObject::getExecutionContext(); | 1695 return ActiveDOMObject::getExecutionContext(); |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 DEFINE_TRACE(XMLHttpRequest) | 1698 DEFINE_TRACE(XMLHttpRequest) |
| 1699 { | 1699 { |
| 1700 visitor->trace(m_responseBlob); | 1700 visitor->trace(m_responseBlob); |
| 1701 visitor->trace(m_responseLegacyStream); | 1701 visitor->trace(m_responseLegacyStream); |
| 1702 visitor->trace(m_responseDocument); | 1702 visitor->trace(m_responseDocument); |
| 1703 visitor->trace(m_responseDocumentParser); | 1703 visitor->trace(m_responseDocumentParser); |
| 1704 visitor->trace(m_responseArrayBuffer); |
| 1704 visitor->trace(m_progressEventThrottle); | 1705 visitor->trace(m_progressEventThrottle); |
| 1705 visitor->trace(m_upload); | 1706 visitor->trace(m_upload); |
| 1706 visitor->trace(m_blobLoader); | 1707 visitor->trace(m_blobLoader); |
| 1707 XMLHttpRequestEventTarget::trace(visitor); | 1708 XMLHttpRequestEventTarget::trace(visitor); |
| 1708 DocumentParserClient::trace(visitor); | 1709 DocumentParserClient::trace(visitor); |
| 1709 ActiveDOMObject::trace(visitor); | 1710 ActiveDOMObject::trace(visitor); |
| 1710 } | 1711 } |
| 1711 | 1712 |
| 1712 } // namespace blink | 1713 } // namespace blink |
| OLD | NEW |