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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 22875053: Do not normalize into NFC the data sent by XMLHttpRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/response-encoding2-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if (contentType.isEmpty()) { 578 if (contentType.isEmpty()) {
579 // FIXME: this should include the charset used for encoding. 579 // FIXME: this should include the charset used for encoding.
580 setRequestHeaderInternal("Content-Type", "application/xml"); 580 setRequestHeaderInternal("Content-Type", "application/xml");
581 } 581 }
582 582
583 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum ent.innerHTML algorithm 583 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum ent.innerHTML algorithm
584 // from the HTML5 specification to serialize the document. 584 // from the HTML5 specification to serialize the document.
585 String body = createMarkup(document); 585 String body = createMarkup(document);
586 586
587 // FIXME: This should use value of document.inputEncoding to determine t he encoding to use. 587 // FIXME: This should use value of document.inputEncoding to determine t he encoding to use.
588 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode (body, WTF::EntitiesForUnencodables)); 588 m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF:: EntitiesForUnencodables));
589 if (m_upload) 589 if (m_upload)
590 m_requestEntityBody->setAlwaysStream(true); 590 m_requestEntityBody->setAlwaysStream(true);
591 } 591 }
592 592
593 createRequest(es); 593 createRequest(es);
594 } 594 }
595 595
596 void XMLHttpRequest::send(const String& body, ExceptionState& es) 596 void XMLHttpRequest::send(const String& body, ExceptionState& es)
597 { 597 {
598 if (!initSend(es)) 598 if (!initSend(es))
599 return; 599 return;
600 600
601 if (!body.isNull() && areMethodAndURLValidForSend()) { 601 if (!body.isNull() && areMethodAndURLValidForSend()) {
602 String contentType = getRequestHeader("Content-Type"); 602 String contentType = getRequestHeader("Content-Type");
603 if (contentType.isEmpty()) { 603 if (contentType.isEmpty()) {
604 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8") ; 604 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8") ;
605 } else { 605 } else {
606 replaceCharsetInMediaType(contentType, "UTF-8"); 606 replaceCharsetInMediaType(contentType, "UTF-8");
607 m_requestHeaders.set("Content-Type", contentType); 607 m_requestHeaders.set("Content-Type", contentType);
608 } 608 }
609 609
610 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode (body, WTF::EntitiesForUnencodables)); 610 m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF:: EntitiesForUnencodables));
611 if (m_upload) 611 if (m_upload)
612 m_requestEntityBody->setAlwaysStream(true); 612 m_requestEntityBody->setAlwaysStream(true);
613 } 613 }
614 614
615 createRequest(es); 615 createRequest(es);
616 } 616 }
617 617
618 void XMLHttpRequest::send(Blob* body, ExceptionState& es) 618 void XMLHttpRequest::send(Blob* body, ExceptionState& es)
619 { 619 {
620 if (!initSend(es)) 620 if (!initSend(es))
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 { 1254 {
1255 return eventNames().interfaceForXMLHttpRequest; 1255 return eventNames().interfaceForXMLHttpRequest;
1256 } 1256 }
1257 1257
1258 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const 1258 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const
1259 { 1259 {
1260 return ActiveDOMObject::scriptExecutionContext(); 1260 return ActiveDOMObject::scriptExecutionContext();
1261 } 1261 }
1262 1262
1263 } // namespace WebCore 1263 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/response-encoding2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698