Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1839)

Unified Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 791783002: Make XMLHttpRequest::send(document) include charset=UTF-8 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/send-document-content-type-charset.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index d656155b3fdb1186e4d61032eada2a8d6afb07c3..aa7c1c38a94b01f1ac32041e4f84039018548a7c 100644
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -791,13 +791,12 @@ void XMLHttpRequest::send(Document* document, ExceptionState& exceptionState)
RefPtr<FormData> httpBody;
if (areMethodAndURLValidForSend()) {
- if (getRequestHeader("Content-Type").isEmpty()) {
- // FIXME: this should include the charset used for encoding.
- setRequestHeaderInternal("Content-Type", "application/xml");
- }
+ // FIXME: Per https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send the
+ // Content-Type header and whether to serialize as HTML or XML should
+ // depend on |document->isHTMLDocument()|.
+ if (getRequestHeader("Content-Type").isEmpty())
+ setRequestHeaderInternal("Content-Type", "application/xml;charset=UTF-8");
- // FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm
- // from the HTML5 specification to serialize the document.
String body = createMarkup(document);
httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesForUnencodables));
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/send-document-content-type-charset.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698