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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 WTF_LOG(Network, "XMLHttpRequest %p send() Document %p", this, document); | 784 WTF_LOG(Network, "XMLHttpRequest %p send() Document %p", this, document); |
785 | 785 |
786 ASSERT(document); | 786 ASSERT(document); |
787 | 787 |
788 if (!initSend(exceptionState)) | 788 if (!initSend(exceptionState)) |
789 return; | 789 return; |
790 | 790 |
791 RefPtr<FormData> httpBody; | 791 RefPtr<FormData> httpBody; |
792 | 792 |
793 if (areMethodAndURLValidForSend()) { | 793 if (areMethodAndURLValidForSend()) { |
794 if (getRequestHeader("Content-Type").isEmpty()) { | 794 // FIXME: Per https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send the |
795 // FIXME: this should include the charset used for encoding. | 795 // Content-Type header and whether to serialize as HTML or XML should |
796 setRequestHeaderInternal("Content-Type", "application/xml"); | 796 // depend on |document->isHTMLDocument()|. |
797 } | 797 if (getRequestHeader("Content-Type").isEmpty()) |
| 798 setRequestHeaderInternal("Content-Type", "application/xml;charset=UT
F-8"); |
798 | 799 |
799 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum
ent.innerHTML algorithm | |
800 // from the HTML5 specification to serialize the document. | |
801 String body = createMarkup(document); | 800 String body = createMarkup(document); |
802 | 801 |
803 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor
Unencodables)); | 802 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor
Unencodables)); |
804 } | 803 } |
805 | 804 |
806 createRequest(httpBody.release(), exceptionState); | 805 createRequest(httpBody.release(), exceptionState); |
807 } | 806 } |
808 | 807 |
809 void XMLHttpRequest::send(const String& body, ExceptionState& exceptionState) | 808 void XMLHttpRequest::send(const String& body, ExceptionState& exceptionState) |
810 { | 809 { |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 visitor->trace(m_responseDocument); | 1791 visitor->trace(m_responseDocument); |
1793 visitor->trace(m_responseDocumentParser); | 1792 visitor->trace(m_responseDocumentParser); |
1794 visitor->trace(m_progressEventThrottle); | 1793 visitor->trace(m_progressEventThrottle); |
1795 visitor->trace(m_upload); | 1794 visitor->trace(m_upload); |
1796 visitor->trace(m_blobLoader); | 1795 visitor->trace(m_blobLoader); |
1797 XMLHttpRequestEventTarget::trace(visitor); | 1796 XMLHttpRequestEventTarget::trace(visitor); |
1798 DocumentParserClient::trace(visitor); | 1797 DocumentParserClient::trace(visitor); |
1799 } | 1798 } |
1800 | 1799 |
1801 } // namespace blink | 1800 } // namespace blink |
OLD | NEW |