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

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

Issue 662383002: Remove FormData::alwaysStream() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 1 month 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 | « no previous file | Source/platform/network/FormData.h » ('j') | 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // FIXME: this should include the charset used for encoding. 689 // FIXME: this should include the charset used for encoding.
690 setRequestHeaderInternal("Content-Type", "application/xml"); 690 setRequestHeaderInternal("Content-Type", "application/xml");
691 } 691 }
692 692
693 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum ent.innerHTML algorithm 693 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum ent.innerHTML algorithm
694 // from the HTML5 specification to serialize the document. 694 // from the HTML5 specification to serialize the document.
695 String body = createMarkup(document); 695 String body = createMarkup(document);
696 696
697 // FIXME: This should use value of document.inputEncoding to determine t he encoding to use. 697 // FIXME: This should use value of document.inputEncoding to determine t he encoding to use.
698 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor Unencodables)); 698 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor Unencodables));
699 if (m_upload)
700 httpBody->setAlwaysStream(true);
701 } 699 }
702 700
703 createRequest(httpBody.release(), exceptionState); 701 createRequest(httpBody.release(), exceptionState);
704 } 702 }
705 703
706 void XMLHttpRequest::send(const String& body, ExceptionState& exceptionState) 704 void XMLHttpRequest::send(const String& body, ExceptionState& exceptionState)
707 { 705 {
708 WTF_LOG(Network, "XMLHttpRequest %p send() String '%s'", this, body.utf8().d ata()); 706 WTF_LOG(Network, "XMLHttpRequest %p send() String '%s'", this, body.utf8().d ata());
709 707
710 if (!initSend(exceptionState)) 708 if (!initSend(exceptionState))
711 return; 709 return;
712 710
713 RefPtr<FormData> httpBody; 711 RefPtr<FormData> httpBody;
714 712
715 if (!body.isNull() && areMethodAndURLValidForSend()) { 713 if (!body.isNull() && areMethodAndURLValidForSend()) {
716 String contentType = getRequestHeader("Content-Type"); 714 String contentType = getRequestHeader("Content-Type");
717 if (contentType.isEmpty()) { 715 if (contentType.isEmpty()) {
718 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8") ; 716 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8") ;
719 } else { 717 } else {
720 replaceCharsetInMediaType(contentType, "UTF-8"); 718 replaceCharsetInMediaType(contentType, "UTF-8");
721 m_requestHeaders.set("Content-Type", AtomicString(contentType)); 719 m_requestHeaders.set("Content-Type", AtomicString(contentType));
722 } 720 }
723 721
724 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor Unencodables)); 722 httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesFor Unencodables));
725 if (m_upload)
726 httpBody->setAlwaysStream(true);
727 } 723 }
728 724
729 createRequest(httpBody.release(), exceptionState); 725 createRequest(httpBody.release(), exceptionState);
730 } 726 }
731 727
732 void XMLHttpRequest::send(Blob* body, ExceptionState& exceptionState) 728 void XMLHttpRequest::send(Blob* body, ExceptionState& exceptionState)
733 { 729 {
734 WTF_LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().ut f8().data()); 730 WTF_LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().ut f8().data());
735 731
736 if (!initSend(exceptionState)) 732 if (!initSend(exceptionState))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 801
806 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta te& exceptionState) 802 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta te& exceptionState)
807 { 803 {
808 if (!initSend(exceptionState)) 804 if (!initSend(exceptionState))
809 return; 805 return;
810 806
811 RefPtr<FormData> httpBody; 807 RefPtr<FormData> httpBody;
812 808
813 if (areMethodAndURLValidForSend()) { 809 if (areMethodAndURLValidForSend()) {
814 httpBody = FormData::create(data, length); 810 httpBody = FormData::create(data, length);
815 if (m_upload)
816 httpBody->setAlwaysStream(true);
817 } 811 }
818 812
819 createRequest(httpBody.release(), exceptionState); 813 createRequest(httpBody.release(), exceptionState);
820 } 814 }
821 815
822 void XMLHttpRequest::sendForInspectorXHRReplay(PassRefPtr<FormData> formData, Ex ceptionState& exceptionState) 816 void XMLHttpRequest::sendForInspectorXHRReplay(PassRefPtr<FormData> formData, Ex ceptionState& exceptionState)
823 { 817 {
824 createRequest(formData ? formData->deepCopy() : nullptr, exceptionState); 818 createRequest(formData ? formData->deepCopy() : nullptr, exceptionState);
825 m_exceptionCode = exceptionState.code(); 819 m_exceptionCode = exceptionState.code();
826 } 820 }
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 visitor->trace(m_responseDocument); 1656 visitor->trace(m_responseDocument);
1663 visitor->trace(m_responseDocumentParser); 1657 visitor->trace(m_responseDocumentParser);
1664 visitor->trace(m_progressEventThrottle); 1658 visitor->trace(m_progressEventThrottle);
1665 visitor->trace(m_upload); 1659 visitor->trace(m_upload);
1666 visitor->trace(m_blobLoader); 1660 visitor->trace(m_blobLoader);
1667 XMLHttpRequestEventTarget::trace(visitor); 1661 XMLHttpRequestEventTarget::trace(visitor);
1668 DocumentParserClient::trace(visitor); 1662 DocumentParserClient::trace(visitor);
1669 } 1663 }
1670 1664
1671 } // namespace blink 1665 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/network/FormData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698