| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "core/xml/XMLHttpRequestProgressEvent.h" | 47 #include "core/xml/XMLHttpRequestProgressEvent.h" |
| 48 #include "core/xml/XMLHttpRequestUpload.h" | 48 #include "core/xml/XMLHttpRequestUpload.h" |
| 49 #include "platform/Logging.h" | 49 #include "platform/Logging.h" |
| 50 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 51 #include "platform/SharedBuffer.h" | 51 #include "platform/SharedBuffer.h" |
| 52 #include "platform/blob/BlobData.h" | 52 #include "platform/blob/BlobData.h" |
| 53 #include "platform/network/HTTPParsers.h" | 53 #include "platform/network/HTTPParsers.h" |
| 54 #include "platform/network/ParsedContentType.h" | 54 #include "platform/network/ParsedContentType.h" |
| 55 #include "platform/network/ResourceError.h" | 55 #include "platform/network/ResourceError.h" |
| 56 #include "platform/network/ResourceRequest.h" | 56 #include "platform/network/ResourceRequest.h" |
| 57 #include "public/platform/Platform.h" | |
| 58 #include "public/platform/WebURLRequest.h" | 57 #include "public/platform/WebURLRequest.h" |
| 59 #include "wtf/ArrayBuffer.h" | 58 #include "wtf/ArrayBuffer.h" |
| 60 #include "wtf/ArrayBufferView.h" | 59 #include "wtf/ArrayBufferView.h" |
| 61 #include "wtf/Assertions.h" | 60 #include "wtf/Assertions.h" |
| 62 #include "wtf/RefCountedLeakCounter.h" | 61 #include "wtf/RefCountedLeakCounter.h" |
| 63 #include "wtf/StdLibExtras.h" | 62 #include "wtf/StdLibExtras.h" |
| 64 #include "wtf/text/CString.h" | 63 #include "wtf/text/CString.h" |
| 65 | 64 |
| 66 namespace WebCore { | 65 namespace WebCore { |
| 67 | 66 |
| 68 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, xmlHttpRequestCounter, ("XM
LHttpRequest")); | 67 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, xmlHttpRequestCounter, ("XM
LHttpRequest")); |
| 69 | 68 |
| 70 // Histogram enum to see when we can deprecate xhr.send(ArrayBuffer). | |
| 71 enum XMLHttpRequestSendArrayBufferOrView { | |
| 72 XMLHttpRequestSendArrayBuffer, | |
| 73 XMLHttpRequestSendArrayBufferView, | |
| 74 XMLHttpRequestSendArrayBufferOrViewMax, | |
| 75 }; | |
| 76 | |
| 77 struct XMLHttpRequestStaticData { | 69 struct XMLHttpRequestStaticData { |
| 78 WTF_MAKE_NONCOPYABLE(XMLHttpRequestStaticData); WTF_MAKE_FAST_ALLOCATED; | 70 WTF_MAKE_NONCOPYABLE(XMLHttpRequestStaticData); WTF_MAKE_FAST_ALLOCATED; |
| 79 public: | 71 public: |
| 80 XMLHttpRequestStaticData(); | 72 XMLHttpRequestStaticData(); |
| 81 String m_proxyHeaderPrefix; | 73 String m_proxyHeaderPrefix; |
| 82 String m_secHeaderPrefix; | 74 String m_secHeaderPrefix; |
| 83 HashSet<String, CaseFoldingHash> m_forbiddenRequestHeaders; | 75 HashSet<String, CaseFoldingHash> m_forbiddenRequestHeaders; |
| 84 }; | 76 }; |
| 85 | 77 |
| 86 XMLHttpRequestStaticData::XMLHttpRequestStaticData() | 78 XMLHttpRequestStaticData::XMLHttpRequestStaticData() |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 753 } |
| 762 } | 754 } |
| 763 | 755 |
| 764 createRequest(httpBody.release(), exceptionState); | 756 createRequest(httpBody.release(), exceptionState); |
| 765 } | 757 } |
| 766 | 758 |
| 767 void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& exceptionState) | 759 void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& exceptionState) |
| 768 { | 760 { |
| 769 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body); | 761 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body); |
| 770 | 762 |
| 771 String consoleMessage("ArrayBuffer is deprecated in XMLHttpRequest.send(). U
se ArrayBufferView instead."); | |
| 772 executionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel,
consoleMessage); | |
| 773 | |
| 774 blink::Platform::current()->histogramEnumeration("WebCore.XHR.send.ArrayBuff
erOrView", XMLHttpRequestSendArrayBuffer, XMLHttpRequestSendArrayBufferOrViewMax
); | |
| 775 | |
| 776 sendBytesData(body->data(), body->byteLength(), exceptionState); | 763 sendBytesData(body->data(), body->byteLength(), exceptionState); |
| 777 } | 764 } |
| 778 | 765 |
| 779 void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& exceptionState) | 766 void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& exceptionState) |
| 780 { | 767 { |
| 781 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBufferView %p", this, body); | 768 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBufferView %p", this, body); |
| 782 | 769 |
| 783 blink::Platform::current()->histogramEnumeration("WebCore.XHR.send.ArrayBuff
erOrView", XMLHttpRequestSendArrayBufferView, XMLHttpRequestSendArrayBufferOrVie
wMax); | |
| 784 | |
| 785 sendBytesData(body->baseAddress(), body->byteLength(), exceptionState); | 770 sendBytesData(body->baseAddress(), body->byteLength(), exceptionState); |
| 786 } | 771 } |
| 787 | 772 |
| 788 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta
te& exceptionState) | 773 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta
te& exceptionState) |
| 789 { | 774 { |
| 790 if (!initSend(exceptionState)) | 775 if (!initSend(exceptionState)) |
| 791 return; | 776 return; |
| 792 | 777 |
| 793 RefPtr<FormData> httpBody; | 778 RefPtr<FormData> httpBody; |
| 794 | 779 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 { | 1448 { |
| 1464 visitor->trace(m_responseBlob); | 1449 visitor->trace(m_responseBlob); |
| 1465 visitor->trace(m_responseStream); | 1450 visitor->trace(m_responseStream); |
| 1466 visitor->trace(m_responseDocument); | 1451 visitor->trace(m_responseDocument); |
| 1467 visitor->trace(m_progressEventThrottle); | 1452 visitor->trace(m_progressEventThrottle); |
| 1468 visitor->trace(m_upload); | 1453 visitor->trace(m_upload); |
| 1469 XMLHttpRequestEventTarget::trace(visitor); | 1454 XMLHttpRequestEventTarget::trace(visitor); |
| 1470 } | 1455 } |
| 1471 | 1456 |
| 1472 } // namespace WebCore | 1457 } // namespace WebCore |
| OLD | NEW |