Changeset 192680 in webkit
- Timestamp:
- Nov 20, 2015, 1:25:56 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r192679 r192680 1 2015-11-20 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 Use HTTPHeaderName as much as possible in XMLHttpRequest 4 https://bugs.webkit.org/show_bug.cgi?id=151438 5 6 Reviewed by Darin Adler. 7 8 Removing XMLHttpRequest::setRequestHeaderInternal and XMLHttpRequest::getRequestHeader. 9 Using directly HTTPHeaderMap.add, HTTPHeaderMap.set and HTTPHeaderMap.get. 10 11 No change in behavior. 12 13 * xml/XMLHttpRequest.cpp: 14 (WebCore::XMLHttpRequest::send): 15 (WebCore::XMLHttpRequest::setRequestHeader): 16 (WebCore::XMLHttpRequest::getAllResponseHeaders): 17 * xml/XMLHttpRequest.h: 18 1 19 2015-11-20 Eric Carlson <eric.carlson@apple.com> 2 20 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r192620 r192680 596 596 #if ENABLE(DASHBOARD_SUPPORT) 597 597 if (usesDashboardBackwardCompatibilityMode()) 598 setRequestHeaderInternal("Content-Type", "application/x-www-form-urlencoded");598 m_requestHeaders.set(HTTPHeaderName::ContentType, ASCIILiteral("application/x-www-form-urlencoded")); 599 599 else 600 600 #endif 601 601 // FIXME: this should include the charset used for encoding. 602 setRequestHeaderInternal("Content-Type", document->isHTMLDocument() ? "text/html;charset=UTF-8":"application/xml;charset=UTF-8");602 m_requestHeaders.set(HTTPHeaderName::ContentType, document->isHTMLDocument() ? ASCIILiteral("text/html;charset=UTF-8") : ASCIILiteral("application/xml;charset=UTF-8")); 603 603 } 604 604 … … 621 621 622 622 if (!body.isNull() && m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily()) { 623 String contentType = getRequestHeader("Content-Type");623 String contentType = m_requestHeaders.get(HTTPHeaderName::ContentType); 624 624 if (contentType.isNull()) { 625 625 #if ENABLE(DASHBOARD_SUPPORT) 626 626 if (usesDashboardBackwardCompatibilityMode()) 627 setRequestHeaderInternal("Content-Type", "application/x-www-form-urlencoded");627 m_requestHeaders.set(HTTPHeaderName::ContentType, ASCIILiteral("application/x-www-form-urlencoded")); 628 628 else 629 629 #endif 630 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8");630 m_requestHeaders.set(HTTPHeaderName::ContentType, ASCIILiteral("text/plain;charset=UTF-8")); 631 631 } else { 632 632 replaceCharsetInMediaType(contentType, "UTF-8"); … … 651 651 const String& blobType = body->type(); 652 652 if (!blobType.isEmpty() && isValidContentType(blobType)) 653 setRequestHeaderInternal("Content-Type", blobType);653 m_requestHeaders.set(HTTPHeaderName::ContentType, blobType); 654 654 else { 655 655 // From FileAPI spec, whenever media type cannot be determined, empty string must be returned. 656 setRequestHeaderInternal("Content-Type", "");656 m_requestHeaders.set(HTTPHeaderName::ContentType, emptyString()); 657 657 } 658 658 } … … 676 676 677 677 if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) 678 setRequestHeaderInternal("Content-Type", makeString("multipart/form-data; boundary=", m_requestEntityBody->boundary().data()));678 m_requestHeaders.set(HTTPHeaderName::ContentType, makeString("multipart/form-data; boundary=", m_requestEntityBody->boundary().data())); 679 679 } 680 680 … … 956 956 } 957 957 958 setRequestHeaderInternal(name, normalizedValue); 959 } 960 961 void XMLHttpRequest::setRequestHeaderInternal(const String& name, const String& value) 962 { 963 m_requestHeaders.add(name, value); 964 } 965 966 String XMLHttpRequest::getRequestHeader(const String& name) const 967 { 968 return m_requestHeaders.get(name); 958 m_requestHeaders.add(name, normalizedValue); 969 959 } 970 960 -
trunk/Source/WebCore/xml/XMLHttpRequest.h
r192361 r192680 177 177 void sendBytesData(const void*, size_t, ExceptionCode&); 178 178 179 String getRequestHeader(const String& name) const;180 void setRequestHeaderInternal(const String& name, const String& value);181 182 179 void changeState(State newState); 183 180 void callReadyStateChangeListener();
Note:
See TracChangeset
for help on using the changeset viewer.