Chromium Code Reviews| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
| 19 * License along with this library; if not, write to the Free Software | 19 * License along with this library; if not, write to the Free Software |
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U SA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U SA |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/xmlhttprequest/XMLHttpRequest.h" | 24 #include "core/xmlhttprequest/XMLHttpRequest.h" |
| 25 | 25 |
| 26 #include "bindings/core/v8/ExceptionState.h" | 26 #include "bindings/core/v8/ExceptionState.h" |
| 27 #include "bindings/core/v8/UnionTypesCore.h" | |
| 27 #include "core/dom/ContextFeatures.h" | 28 #include "core/dom/ContextFeatures.h" |
| 28 #include "core/dom/DOMArrayBuffer.h" | 29 #include "core/dom/DOMArrayBuffer.h" |
| 29 #include "core/dom/DOMArrayBufferView.h" | 30 #include "core/dom/DOMArrayBufferView.h" |
| 30 #include "core/dom/DOMException.h" | 31 #include "core/dom/DOMException.h" |
| 31 #include "core/dom/DOMImplementation.h" | 32 #include "core/dom/DOMImplementation.h" |
| 32 #include "core/dom/DOMTypedArray.h" | 33 #include "core/dom/DOMTypedArray.h" |
| 33 #include "core/dom/DocumentParser.h" | 34 #include "core/dom/DocumentParser.h" |
| 34 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
| 35 #include "core/dom/XMLDocument.h" | 36 #include "core/dom/XMLDocument.h" |
| 36 #include "core/editing/markup.h" | 37 #include "core/editing/markup.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 786 | 787 |
| 787 if (m_state != OPENED || m_loader) { | 788 if (m_state != OPENED || m_loader) { |
| 788 exceptionState.throwDOMException(InvalidStateError, "The object's state must be OPENED."); | 789 exceptionState.throwDOMException(InvalidStateError, "The object's state must be OPENED."); |
| 789 return false; | 790 return false; |
| 790 } | 791 } |
| 791 | 792 |
| 792 m_error = false; | 793 m_error = false; |
| 793 return true; | 794 return true; |
| 794 } | 795 } |
| 795 | 796 |
| 797 void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrHT MLDocumentOrStringOrFormData& data, ExceptionState& exceptionState) | |
| 798 { | |
| 799 InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url()); | |
| 800 if (data.isNull()) { | |
| 801 send(exceptionState); | |
| 802 return; | |
| 803 } | |
| 804 | |
| 805 if (data.isArrayBuffer()) { | |
| 806 send(data.getAsArrayBuffer().get(), exceptionState); | |
| 807 return; | |
| 808 } | |
| 809 | |
| 810 if (data.isArrayBufferView()) { | |
| 811 send(data.getAsArrayBufferView().get(), exceptionState); | |
| 812 return; | |
| 813 } | |
| 814 | |
| 815 if (data.isBlob()) { | |
| 816 send(data.getAsBlob(), exceptionState); | |
| 817 return; | |
| 818 } | |
| 819 | |
| 820 if (data.isDocument() || data.isHTMLDocument()) { | |
| 821 Document* document = data.isDocument() ? data.getAsDocument().get() : da ta.getAsHTMLDocument().get(); | |
| 822 send(document, exceptionState); | |
| 823 return; | |
| 824 } | |
| 825 | |
| 826 if (data.isHTMLDocument()) { | |
|
yhirano
2015/03/23 11:50:41
This branch will never be taken.
vivekg
2015/03/23 11:57:36
Right!
| |
| 827 send(data.getAsHTMLDocument().get(), exceptionState); | |
| 828 return; | |
| 829 } | |
| 830 | |
| 831 if (data.isFormData()) { | |
| 832 send(data.getAsFormData().get(), exceptionState); | |
| 833 return; | |
| 834 } | |
| 835 | |
| 836 ASSERT(data.isString()); | |
| 837 send(data.getAsString(), exceptionState); | |
| 838 } | |
| 839 | |
| 796 void XMLHttpRequest::send(ExceptionState& exceptionState) | 840 void XMLHttpRequest::send(ExceptionState& exceptionState) |
| 797 { | 841 { |
| 842 InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url()); | |
|
yhirano
2015/03/23 11:50:41
Is this change related to the issue?
vivekg
2015/03/23 11:57:36
Yes this is being handled in https://code.google.c
yhirano
2015/03/23 12:44:33
Thanks, I see.
| |
| 798 send(String(), exceptionState); | 843 send(String(), exceptionState); |
| 799 } | 844 } |
| 800 | 845 |
| 801 bool XMLHttpRequest::areMethodAndURLValidForSend() | 846 bool XMLHttpRequest::areMethodAndURLValidForSend() |
| 802 { | 847 { |
| 803 return m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFami ly(); | 848 return m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFami ly(); |
| 804 } | 849 } |
| 805 | 850 |
| 806 void XMLHttpRequest::send(Document* document, ExceptionState& exceptionState) | 851 void XMLHttpRequest::send(Document* document, ExceptionState& exceptionState) |
| 807 { | 852 { |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1827 visitor->trace(m_responseDocumentParser); | 1872 visitor->trace(m_responseDocumentParser); |
| 1828 visitor->trace(m_progressEventThrottle); | 1873 visitor->trace(m_progressEventThrottle); |
| 1829 visitor->trace(m_upload); | 1874 visitor->trace(m_upload); |
| 1830 visitor->trace(m_blobLoader); | 1875 visitor->trace(m_blobLoader); |
| 1831 XMLHttpRequestEventTarget::trace(visitor); | 1876 XMLHttpRequestEventTarget::trace(visitor); |
| 1832 DocumentParserClient::trace(visitor); | 1877 DocumentParserClient::trace(visitor); |
| 1833 ActiveDOMObject::trace(visitor); | 1878 ActiveDOMObject::trace(visitor); |
| 1834 } | 1879 } |
| 1835 | 1880 |
| 1836 } // namespace blink | 1881 } // namespace blink |
| OLD | NEW |