Change HTTPHeaderValues from a struct to a namespace
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Oct 2016 06:10:47 +0000 (06:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Oct 2016 06:10:47 +0000 (06:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163203

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-10
Reviewed by Alex Christensen.

No change of behavior.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract):
* platform/network/HTTPHeaderValues.cpp:
(WebCore::HTTPHeaderValues::textPlainContentType):
(WebCore::HTTPHeaderValues::formURLEncodedContentType):
(WebCore::HTTPHeaderValues::TextPlainContentType): Deleted.
(WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted.
* platform/network/HTTPHeaderValues.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207046 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBody.cpp
Source/WebCore/platform/network/HTTPHeaderValues.cpp
Source/WebCore/platform/network/HTTPHeaderValues.h
Source/WebCore/xml/XMLHttpRequest.cpp

index 28e9b4a..97a0461 100644 (file)
@@ -1,3 +1,23 @@
+2016-10-10  Youenn Fablet  <youenn@apple.com>
+
+        Change HTTPHeaderValues from a struct to a namespace
+        https://bugs.webkit.org/show_bug.cgi?id=163203
+
+        Reviewed by Alex Christensen.
+
+        No change of behavior.
+
+        * Modules/fetch/FetchBody.cpp:
+        (WebCore::FetchBody::extract):
+        * platform/network/HTTPHeaderValues.cpp:
+        (WebCore::HTTPHeaderValues::textPlainContentType):
+        (WebCore::HTTPHeaderValues::formURLEncodedContentType):
+        (WebCore::HTTPHeaderValues::TextPlainContentType): Deleted.
+        (WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted.
+        * platform/network/HTTPHeaderValues.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::send):
+
 2016-10-10  Chris Dumez  <cdumez@apple.com>
 
         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
index 3093675..4fd4a07 100644 (file)
@@ -63,11 +63,11 @@ Optional<FetchBody> FetchBody::extract(ScriptExecutionContext& context, JSC::Exe
         return FetchBody(WTFMove(formData));
     }
     if (value.isString()) {
-        contentType = HTTPHeaderValues::TextPlainContentType();
+        contentType = HTTPHeaderValues::textPlainContentType();
         return FetchBody(value.toWTFString(&state));
     }
     if (value.inherits(JSURLSearchParams::info())) {
-        contentType = HTTPHeaderValues::FormURLEncodedContentType();
+        contentType = HTTPHeaderValues::formURLEncodedContentType();
         return FetchBody(*JSURLSearchParams::toWrapped(value));
     }
     if (value.inherits(JSReadableStream::info()))
index b0383e1..4642d05 100644 (file)
 
 namespace WebCore {
 
-const String& HTTPHeaderValues::TextPlainContentType()
+namespace HTTPHeaderValues {
+
+const String& textPlainContentType()
 {
     static NeverDestroyed<const String> contentType(ASCIILiteral("text/plain;charset=UTF-8"));
     return contentType;
 }
 
-const String& HTTPHeaderValues::FormURLEncodedContentType()
+const String& formURLEncodedContentType()
 {
     static NeverDestroyed<const String> contentType(ASCIILiteral("application/x-www-form-urlencoded;charset=UTF-8"));
     return contentType;
 }
 
 }
+
+}
index 185c0a1..299b5a7 100644 (file)
 
 namespace WebCore {
 
-struct HTTPHeaderValues {
-    static const String& TextPlainContentType();
-    static const String& FormURLEncodedContentType();
-};
+namespace HTTPHeaderValues {
+
+const String& textPlainContentType();
+const String& formURLEncodedContentType();
+
+}
 
 }
index c9615a4..dfe15f5 100644 (file)
@@ -546,7 +546,7 @@ ExceptionOr<void> XMLHttpRequest::send(const String& body)
                 m_requestHeaders.set(HTTPHeaderName::ContentType, ASCIILiteral("application/x-www-form-urlencoded"));
             else
 #endif
-                m_requestHeaders.set(HTTPHeaderName::ContentType, HTTPHeaderValues::TextPlainContentType());
+                m_requestHeaders.set(HTTPHeaderName::ContentType, HTTPHeaderValues::textPlainContentType());
         } else {
             replaceCharsetInMediaType(contentType, "UTF-8");
             m_requestHeaders.set(HTTPHeaderName::ContentType, contentType);