Don't use AtomicString in HTTPHeaderMap
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 22:28:18 +0000 (22:28 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 22:28:18 +0000 (22:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133957
<rdar://problem/15256572>

Reviewed by Andreas Kling.

Source/WebCore:
Use the string data that comes from the generated HTTPHeaderNames.cpp file
for sharing header name data instead. In the future we can do something more fancy where
we'll hash the HTTPHeaderName enum directly, but this is good enough for now.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::readHTTPHeaders):
* WebCore.exp.in:
* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForHeaders):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::parseHeader):
* loader/cache/CachedResource.cpp:
(WebCore::shouldUpdateHeaderAfterRevalidation):
* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::copyData):
(WebCore::internHTTPHeaderNameString):
(WebCore::HTTPHeaderMap::get):
(WebCore::HTTPHeaderMap::set):
(WebCore::HTTPHeaderMap::add):
(WebCore::CaseFoldingCStringTranslator::hash): Deleted.
(WebCore::CaseFoldingCStringTranslator::equal): Deleted.
(WebCore::CaseFoldingCStringTranslator::translate): Deleted.
* platform/network/HTTPHeaderMap.h:
* platform/network/HTTPHeaderNames.in:
* platform/network/HTTPParsers.cpp:
(WebCore::parseHTTPHeader):
* platform/network/HTTPParsers.h:
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::httpHeaderField):
(WebCore::ResourceRequestBase::setHTTPHeaderField):
(WebCore::ResourceRequestBase::addHTTPHeaderField):
* platform/network/ResourceRequestBase.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::httpHeaderField):
(WebCore::ResourceResponseBase::setHTTPHeaderField):
(WebCore::ResourceResponseBase::addHTTPHeaderField):
* platform/network/ResourceResponseBase.h:
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::doUpdateResourceRequest):
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::platformLazyInit):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::setRequestHeader):
(WebCore::XMLHttpRequest::setRequestHeaderInternal):
(WebCore::XMLHttpRequest::getRequestHeader):
(WebCore::XMLHttpRequest::getResponseHeader):
* xml/XMLHttpRequest.h:

Source/WebKit2:
Update for WebCore changes.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<HTTPHeaderMap>::decode):

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

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/WebCore.exp.in
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/platform/network/HTTPHeaderMap.cpp
Source/WebCore/platform/network/HTTPHeaderMap.h
Source/WebCore/platform/network/HTTPHeaderNames.in
Source/WebCore/platform/network/HTTPParsers.cpp
Source/WebCore/platform/network/HTTPParsers.h
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/platform/network/ResourceRequestBase.h
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebCore/platform/network/mac/ResourceResponseMac.mm
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp

index 83de2e8..21ee231 100644 (file)
@@ -1,3 +1,61 @@
+2014-06-16  Anders Carlsson  <andersca@apple.com>
+
+        Don't use AtomicString in HTTPHeaderMap
+        https://bugs.webkit.org/show_bug.cgi?id=133957
+        <rdar://problem/15256572>
+
+        Reviewed by Andreas Kling.
+
+        Use the string data that comes from the generated HTTPHeaderNames.cpp file
+        for sharing header name data instead. In the future we can do something more fancy where
+        we'll hash the HTTPHeaderName enum directly, but this is good enough for now.
+
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::readHTTPHeaders):
+        * WebCore.exp.in:
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::buildObjectForHeaders):
+        * loader/CrossOriginPreflightResultCache.cpp:
+        (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::parseHeader):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::shouldUpdateHeaderAfterRevalidation):
+        * platform/network/HTTPHeaderMap.cpp:
+        (WebCore::HTTPHeaderMap::copyData):
+        (WebCore::internHTTPHeaderNameString):
+        (WebCore::HTTPHeaderMap::get):
+        (WebCore::HTTPHeaderMap::set):
+        (WebCore::HTTPHeaderMap::add):
+        (WebCore::CaseFoldingCStringTranslator::hash): Deleted.
+        (WebCore::CaseFoldingCStringTranslator::equal): Deleted.
+        (WebCore::CaseFoldingCStringTranslator::translate): Deleted.
+        * platform/network/HTTPHeaderMap.h:
+        * platform/network/HTTPHeaderNames.in:
+        * platform/network/HTTPParsers.cpp:
+        (WebCore::parseHTTPHeader):
+        * platform/network/HTTPParsers.h:
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::httpHeaderField):
+        (WebCore::ResourceRequestBase::setHTTPHeaderField):
+        (WebCore::ResourceRequestBase::addHTTPHeaderField):
+        * platform/network/ResourceRequestBase.h:
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::httpHeaderField):
+        (WebCore::ResourceResponseBase::setHTTPHeaderField):
+        (WebCore::ResourceResponseBase::addHTTPHeaderField):
+        * platform/network/ResourceResponseBase.h:
+        * platform/network/mac/ResourceRequestMac.mm:
+        (WebCore::ResourceRequest::doUpdateResourceRequest):
+        * platform/network/mac/ResourceResponseMac.mm:
+        (WebCore::ResourceResponse::platformLazyInit):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::setRequestHeader):
+        (WebCore::XMLHttpRequest::setRequestHeaderInternal):
+        (WebCore::XMLHttpRequest::getRequestHeader):
+        (WebCore::XMLHttpRequest::getResponseHeader):
+        * xml/XMLHttpRequest.h:
+
 2014-06-16  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Safari crashed once in WebCore::AccessibilityObject::ariaIsHidden
index 0c64fa1..33fdcba 100644 (file)
@@ -461,7 +461,7 @@ int WebSocketHandshake::readStatusLine(const char* header, size_t headerLength,
 
 const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* end)
 {
-    AtomicString name;
+    String name;
     String value;
     bool sawSecWebSocketExtensionsHeaderField = false;
     bool sawSecWebSocketAcceptHeaderField = false;
index bb2d4b8..a2d2b25 100644 (file)
@@ -289,8 +289,7 @@ __ZN7WebCore13GraphicsLayer7setSizeERKNS_9FloatSizeE
 __ZN7WebCore13GraphicsLayer8addChildEPS0_
 __ZN7WebCore13GraphicsLayerC2ERNS_19GraphicsLayerClientE
 __ZN7WebCore13GraphicsLayerD2Ev
-__ZN7WebCore13HTTPHeaderMap3addERKN3WTF12AtomicStringERKNS1_6StringE
-__ZN7WebCore13HTTPHeaderMap3setERKN3WTF12AtomicStringERKNS1_6StringE
+__ZN7WebCore13HTTPHeaderMap3setERKN3WTF6StringES4_
 __ZN7WebCore13HTTPHeaderMap6removeENS_14HTTPHeaderNameE
 __ZN7WebCore13HTTPHeaderMapC1Ev
 __ZN7WebCore13HTTPHeaderMapD1Ev
@@ -857,7 +856,7 @@ __ZN7WebCore20ResourceHandleClientD2Ev
 __ZN7WebCore20ResourceResponseBase11setMimeTypeERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase17setHTTPStatusCodeEi
 __ZN7WebCore20ResourceResponseBase17setHTTPStatusTextERKN3WTF6StringE
-__ZN7WebCore20ResourceResponseBase18setHTTPHeaderFieldERKN3WTF12AtomicStringERKNS1_6StringE
+__ZN7WebCore20ResourceResponseBase18setHTTPHeaderFieldERKN3WTF6StringES4_
 __ZN7WebCore20ResourceResponseBase19setTextEncodingNameERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase20setSuggestedFilenameERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
@@ -1609,7 +1608,7 @@ __ZNK7WebCore13GraphicsLayer18accumulatedOpacityEv
 __ZNK7WebCore13GraphicsLayer18getDebugBorderInfoERNS_5ColorERf
 __ZNK7WebCore13GraphicsLayer26backingStoreMemoryEstimateEv
 __ZNK7WebCore13HTTPHeaderMap3getENS_14HTTPHeaderNameE
-__ZNK7WebCore13HTTPHeaderMap3getERKN3WTF12AtomicStringE
+__ZNK7WebCore13HTTPHeaderMap3getERKN3WTF6StringE
 __ZNK7WebCore13HitTestResult10isLiveLinkEv
 __ZNK7WebCore13HitTestResult10isSelectedEv
 __ZNK7WebCore13HitTestResult11targetFrameEv
index 2ec34b0..c1bae8a 100644 (file)
@@ -197,7 +197,7 @@ static PassRefPtr<InspectorObject> buildObjectForHeaders(const HTTPHeaderMap& he
     RefPtr<InspectorObject> headersObject = InspectorObject::create();
     
     for (const auto& header : headers)
-        headersObject->setString(header.key.string(), header.value);
+        headersObject->setString(header.key, header.value);
     return headersObject;
 }
 
index 2ddef70..d36c48e 100644 (file)
@@ -128,7 +128,7 @@ bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHea
 {
     for (const auto& header : requestHeaders) {
         if (!m_headers.contains(header.key) && !isOnAccessControlSimpleRequestHeaderWhitelist(header.key, header.value)) {
-            errorDescription = "Request header field " + header.key.string() + " is not allowed by Access-Control-Allow-Headers.";
+            errorDescription = "Request header field " + header.key + " is not allowed by Access-Control-Allow-Headers.";
             return false;
         }
     }
index 601ce0c..982a342 100644 (file)
@@ -1094,7 +1094,7 @@ static inline void parseHeader(const CharacterType* header, size_t headerLength,
     size_t pos = find(header, headerLength, ':');
     ASSERT(pos != notFound);
     
-    AtomicString headerName = AtomicString(header, pos);
+    String headerName = AtomicString(header, pos);
     String headerValue = String(header + pos + 1, headerLength - pos - 1);
     
     response.setHTTPHeaderField(headerName, headerValue);
index 2d5f5e4..96d498b 100644 (file)
@@ -92,7 +92,7 @@ const char* const headerPrefixesToIgnoreAfterRevalidation[] = {
     "x-webkit-"
 };
 
-static inline bool shouldUpdateHeaderAfterRevalidation(const AtomicString& header)
+static inline bool shouldUpdateHeaderAfterRevalidation(const String& header)
 {
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(headersToIgnoreAfterRevalidation); i++) {
         if (equalIgnoringCase(header, headersToIgnoreAfterRevalidation[i]))
index b405e27..cc3ecc3 100644 (file)
@@ -51,7 +51,7 @@ std::unique_ptr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const
     data->reserveInitialCapacity(m_headers.size());
 
     for (const auto& header : *this)
-        data->uncheckedAppend(std::make_pair(header.key.string().isolatedCopy(), header.value.isolatedCopy()));
+        data->uncheckedAppend(std::make_pair(header.key.isolatedCopy(), header.value.isolatedCopy()));
 
     return data;
 }
@@ -64,41 +64,32 @@ void HTTPHeaderMap::adopt(std::unique_ptr<CrossThreadHTTPHeaderMapData> data)
         m_headers.add(std::move(header.first), std::move(header.second));
 }
 
-String HTTPHeaderMap::get(const AtomicString& name) const
+static String internHTTPHeaderNameString(const String& nameString)
 {
-    return m_headers.get(name);
+    HTTPHeaderName headerName;
+    if (!findHTTPHeaderName(nameString, headerName))
+        return nameString;
+
+    return httpHeaderNameString(headerName).toStringWithoutCopying();
 }
 
-void HTTPHeaderMap::set(const AtomicString& name, const String& value)
+String HTTPHeaderMap::get(const String& name) const
 {
-    m_headers.set(name, value);
+    return m_headers.get(internHTTPHeaderNameString(name));
 }
 
-void HTTPHeaderMap::add(const AtomicString& name, const String& value)
+void HTTPHeaderMap::set(const String& name, const String& value)
 {
-    auto result = m_headers.add(name, value);
+    m_headers.set(internHTTPHeaderNameString(name), value);
+}
+
+void HTTPHeaderMap::add(const String& name, const String& value)
+{
+    auto result = m_headers.add(internHTTPHeaderNameString(name), value);
     if (!result.isNewEntry)
         result.iterator->value = result.iterator->value + ", " + value;
 }
 
-// Adapter that allows the HashMap to take C strings as keys.
-struct CaseFoldingCStringTranslator {
-    static unsigned hash(const char* cString)
-    {
-        return CaseFoldingHash::hash(cString, strlen(cString));
-    }
-    
-    static bool equal(const AtomicString& key, const char* cString)
-    {
-        return equalIgnoringCase(key, cString);
-    }
-    
-    static void translate(AtomicString& location, const char* cString, unsigned /*hash*/)
-    {
-        location = AtomicString(cString);
-    }
-};
-
 String HTTPHeaderMap::get(HTTPHeaderName name) const
 {
     auto it = find(name);
index c60e11e..5904eea 100644 (file)
@@ -43,7 +43,7 @@ typedef Vector<std::pair<String, String>> CrossThreadHTTPHeaderMapData;
 // FIXME: Not every header fits into a map. Notably, multiple Set-Cookie header fields are needed to set multiple cookies.
 
 class HTTPHeaderMap {
-    typedef HashMap<AtomicString, String, CaseFoldingHash> HashMapType;
+    typedef HashMap<String, String, CaseFoldingHash> HashMapType;
 public:
     typedef HashMapType::const_iterator const_iterator;
 
@@ -59,9 +59,9 @@ public:
 
     void clear() { m_headers.clear(); }
 
-    String get(const AtomicString& name) const;
-    void set(const AtomicString& name, const String& value);
-    void add(const AtomicString& name, const String& value);
+    String get(const String& name) const;
+    void set(const String& name, const String& value);
+    void add(const String& name, const String& value);
 
     String get(HTTPHeaderName) const;
     void set(HTTPHeaderName, const String& value);
@@ -90,6 +90,9 @@ public:
     }
 
 private:
+    // FIXME: Instead of having a HashMap<String, String>, we could have two hash maps,
+    // one HashMap<HTTPHeaderName, String> for common headers and another HashMap<String, String> for
+    // less common headers.
     HashMapType m_headers;
 };
 
index ca25d66..04134c9 100644 (file)
@@ -25,7 +25,9 @@
 
 Accept
 Accept-Charset
+Accept-Language
 Accept-Encoding
+Accept-Ranges
 Access-Control-Allow-Credentials
 Access-Control-Allow-Headers
 Access-Control-Allow-Methods
@@ -35,6 +37,7 @@ Access-Control-Max-Age
 Access-Control-Request-Headers
 Access-Control-Request-Method
 Age
+Alternate-Protocol
 Authorization
 Cache-Control
 Connection
@@ -77,6 +80,7 @@ Sec-WebSocket-Extensions
 Sec-WebSocket-Key
 Sec-WebSocket-Protocol
 Sec-WebSocket-Version
+Server
 Set-Cookie
 Set-Cookie2
 TE
@@ -85,11 +89,16 @@ Trailer
 Transfer-Encoding
 Upgrade
 User-Agent
+Vary
 Via
+X-Check-Cacheable
+X-Content-Type-Options
 X-DNS-Prefetch-Control
 X-Frame-Options
+X-Powered-By
 X-WebKit-CSP
 X-WebKit-CSP-Report-Only
+X-XSS-Protection
 
 // These headers are specific to GStreamer.
 Accept-Ranges
index 26f90ce..c0fcc81 100644 (file)
@@ -605,7 +605,7 @@ size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReas
     return end - data;
 }
 
-size_t parseHTTPHeader(const char* start, size_t length, String& failureReason, AtomicString& nameStr, String& valueStr, bool strict)
+size_t parseHTTPHeader(const char* start, size_t length, String& failureReason, String& nameStr, String& valueStr, bool strict)
 {
     const char* p = start;
     const char* end = start + length;
@@ -665,7 +665,7 @@ size_t parseHTTPHeader(const char* start, size_t length, String& failureReason,
         failureReason = "CR doesn't follow LF after value at " + trimInputSample(p, end - p);
         return 0;
     }
-    nameStr = AtomicString::fromUTF8(name.data(), name.size());
+    nameStr = String::fromUTF8(name.data(), name.size());
     valueStr = String::fromUTF8(value.data(), value.size());
     if (nameStr.isNull()) {
         failureReason = "Invalid UTF-8 sequence in header name";
index 7e5bbcd..8ae144b 100644 (file)
@@ -83,7 +83,7 @@ ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header
 // Parsing Complete HTTP Messages.
 enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 };
 size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReason, String& method, String& url, HTTPVersion&);
-size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, AtomicString& nameStr, String& valueStr, bool strict = true);
+size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, String& nameStr, String& valueStr, bool strict = true);
 size_t parseHTTPRequestBody(const char* data, size_t length, Vector<unsigned char>& body);
 
 }
index 5286db5..0826aa7 100644 (file)
@@ -232,7 +232,7 @@ const HTTPHeaderMap& ResourceRequestBase::httpHeaderFields() const
     return m_httpHeaderFields; 
 }
 
-String ResourceRequestBase::httpHeaderField(const AtomicString& name) const
+String ResourceRequestBase::httpHeaderField(const String& name) const
 {
     updateResourceRequest(); 
     
@@ -246,7 +246,7 @@ String ResourceRequestBase::httpHeaderField(HTTPHeaderName name) const
     return m_httpHeaderFields.get(name);
 }
 
-void ResourceRequestBase::setHTTPHeaderField(const AtomicString& name, const String& value)
+void ResourceRequestBase::setHTTPHeaderField(const String& name, const String& value)
 {
     updateResourceRequest();
 
@@ -453,7 +453,7 @@ void ResourceRequestBase::setPriority(ResourceLoadPriority priority)
         m_platformRequestUpdated = false;
 }
 
-void ResourceRequestBase::addHTTPHeaderField(const AtomicString& name, const String& value) 
+void ResourceRequestBase::addHTTPHeaderField(const String& name, const String& value) 
 {
     updateResourceRequest();
 
index a4b236d..810c196 100644 (file)
@@ -82,11 +82,11 @@ namespace WebCore {
         const HTTPHeaderMap& httpHeaderFields() const;
         void setHTTPHeaderFields(HTTPHeaderMap);
 
-        String httpHeaderField(const AtomicString& name) const;
+        String httpHeaderField(const String& name) const;
         String httpHeaderField(HTTPHeaderName) const;
-        void setHTTPHeaderField(const AtomicString& name, const String& value);
+        void setHTTPHeaderField(const String& name, const String& value);
         void setHTTPHeaderField(HTTPHeaderName, const String& value);
-        void addHTTPHeaderField(const AtomicString& name, const String& value);
+        void addHTTPHeaderField(const String& name, const String& value);
 
         // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
         template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
index 1a87e00..a0f7169 100644 (file)
@@ -259,7 +259,7 @@ void ResourceResponseBase::setHTTPStatusText(const String& statusText)
     // FIXME: Should invalidate or update platform response if present.
 }
 
-String ResourceResponseBase::httpHeaderField(const AtomicString& name) const
+String ResourceResponseBase::httpHeaderField(const String& name) const
 {
     lazyInit(CommonFieldsOnly);
 
@@ -316,12 +316,12 @@ void ResourceResponseBase::updateHeaderParsedState(HTTPHeaderName name)
     }
 }
 
-void ResourceResponseBase::setHTTPHeaderField(const AtomicString& name, const String& value)
+void ResourceResponseBase::setHTTPHeaderField(const String& name, const String& value)
 {
     lazyInit(CommonAndUncommonFields);
 
     HTTPHeaderName headerName;
-    if (findHTTPHeaderName(name.string(), headerName))
+    if (findHTTPHeaderName(name, headerName))
         updateHeaderParsedState(headerName);
 
     m_httpHeaderFields.set(name, value);
@@ -340,12 +340,12 @@ void ResourceResponseBase::setHTTPHeaderField(HTTPHeaderName name, const String&
     // FIXME: Should invalidate or update platform response if present.
 }
 
-void ResourceResponseBase::addHTTPHeaderField(const AtomicString& name, const String& value)
+void ResourceResponseBase::addHTTPHeaderField(const String& name, const String& value)
 {
     lazyInit(CommonAndUncommonFields);
 
     HTTPHeaderName headerName;
-    if (findHTTPHeaderName(name.string(), headerName))
+    if (findHTTPHeaderName(name, headerName))
         updateHeaderParsedState(headerName);
 
     m_httpHeaderFields.add(name, value);
index 4d015b9..f71133b 100644 (file)
@@ -80,12 +80,12 @@ public:
 
     const HTTPHeaderMap& httpHeaderFields() const;
 
-    String httpHeaderField(const AtomicString& name) const;
+    String httpHeaderField(const String& name) const;
     String httpHeaderField(HTTPHeaderName) const;
-    void setHTTPHeaderField(const AtomicString& name, const String& value);
+    void setHTTPHeaderField(const String& name, const String& value);
     void setHTTPHeaderField(HTTPHeaderName, const String& value);
 
-    void addHTTPHeaderField(const AtomicString& name, const String& value);
+    void addHTTPHeaderField(const String& name, const String& value);
 
     // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
     template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
index 2914f72..20d9ffa 100644 (file)
@@ -116,7 +116,7 @@ void ResourceRequest::doUpdateResourceRequest()
     NSString *name;
     m_httpHeaderFields.clear();
     while ((name = [e nextObject]))
-        m_httpHeaderFields.set(name, [headers objectForKey:name]);
+        m_httpHeaderFields.set(String(name), [headers objectForKey:name]);
 
     m_responseContentDispositionEncodingFallbackArray.clear();
     NSArray *encodingFallbacks = [m_nsRequest.get() contentDispositionEncodingFallbackArray];
index 5ba5fa3..3d87376 100644 (file)
@@ -131,7 +131,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
             
             for (unsigned i = 0; i < WTF_ARRAY_LENGTH(commonHeaderFields); ++i) {
                 if (NSString* headerValue = [headers objectForKey:commonHeaderFields[i]])
-                    m_httpHeaderFields.set([commonHeaderFields[i] UTF8String], headerValue);
+                    m_httpHeaderFields.set(String(commonHeaderFields[i]), headerValue);
             }
         } else
             m_httpStatusCode = 0;
@@ -154,7 +154,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
             NSDictionary *headers = [httpResponse allHeaderFields];
             NSEnumerator *e = [headers keyEnumerator];
             while (NSString *name = [e nextObject])
-                m_httpHeaderFields.set(name, [headers objectForKey:name]);
+                m_httpHeaderFields.set(String(name), [headers objectForKey:name]);
             
             [pool drain];
         }
index 416e866..e5cf53e 100644 (file)
@@ -913,7 +913,7 @@ void XMLHttpRequest::overrideMimeType(const String& override)
     m_mimeTypeOverride = override;
 }
 
-void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
+void XMLHttpRequest::setRequestHeader(const String& name, const String& value, ExceptionCode& ec)
 {
     if (m_state != OPENED || m_loader) {
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -939,12 +939,12 @@ void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va
     setRequestHeaderInternal(name, value);
 }
 
-void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const String& value)
+void XMLHttpRequest::setRequestHeaderInternal(const String& name, const String& value)
 {
     m_requestHeaders.add(name, value);
 }
 
-String XMLHttpRequest::getRequestHeader(const AtomicString& name) const
+String XMLHttpRequest::getRequestHeader(const String& name) const
 {
     return m_requestHeaders.get(name);
 }
@@ -983,7 +983,7 @@ String XMLHttpRequest::getAllResponseHeaders() const
     return stringBuilder.toString();
 }
 
-String XMLHttpRequest::getResponseHeader(const AtomicString& name) const
+String XMLHttpRequest::getResponseHeader(const String& name) const
 {
     if (m_state < HEADERS_RECEIVED || m_error)
         return String();
index 4f5a53b..710f6f7 100644 (file)
@@ -102,11 +102,11 @@ public:
     void send(JSC::ArrayBuffer*, ExceptionCode&);
     void send(JSC::ArrayBufferView*, ExceptionCode&);
     void abort();
-    void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&);
+    void setRequestHeader(const String& name, const String& value, ExceptionCode&);
     void overrideMimeType(const String& override);
     bool doneWithoutErrors() const { return !m_error && m_state == DONE; }
     String getAllResponseHeaders() const;
-    String getResponseHeader(const AtomicString& name) const;
+    String getResponseHeader(const String& name) const;
     String responseText(ExceptionCode&);
     String responseTextIgnoringResponseType() const { return m_responseBuilder.toStringPreserveCapacity(); }
     String responseMIMEType() const;
@@ -189,8 +189,8 @@ private:
     bool initSend(ExceptionCode&);
     void sendBytesData(const void*, size_t, ExceptionCode&);
 
-    String getRequestHeader(const AtomicString& name) const;
-    void setRequestHeaderInternal(const AtomicString& name, const String& value);
+    String getRequestHeader(const String& name) const;
+    void setRequestHeaderInternal(const String& name, const String& value);
 
     void changeState(State newState);
     void callReadyStateChangeListener();
index 1a9b58c..a06f7ea 100644 (file)
@@ -1,3 +1,16 @@
+2014-06-16  Anders Carlsson  <andersca@apple.com>
+
+        Don't use AtomicString in HTTPHeaderMap
+        https://bugs.webkit.org/show_bug.cgi?id=133957
+        <rdar://problem/15256572>
+
+        Reviewed by Andreas Kling.
+
+        Update for WebCore changes.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<HTTPHeaderMap>::decode):
+
 2014-06-15  Anders Carlsson  <andersca@apple.com>
 
         Change ResourceRequestBase::addHTTPHeaderFields to setHTTPHeaderFields instead
index 8a1e3b3..f90aac8 100644 (file)
@@ -409,7 +409,7 @@ bool ArgumentCoder<HTTPHeaderMap>::decode(ArgumentDecoder& decoder, HTTPHeaderMa
         return false;
 
     for (size_t i = 0; i < size; ++i) {
-        AtomicString name;
+        String name;
         if (!decoder.decode(name))
             return false;