Title: [169941] trunk/Source/WebCore
Revision
169941
Author
ander...@apple.com
Date
2014-06-13 11:56:29 -0700 (Fri, 13 Jun 2014)

Log Message

Add a HTTPHeaderMap::find overload that takes a HTTPHeaderName
https://bugs.webkit.org/show_bug.cgi?id=133872

Reviewed by Andreas Kling.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::get):
(WebCore::HTTPHeaderMap::find):
* platform/network/HTTPHeaderMap.h:
* platform/network/HTTPHeaderNames.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (169940 => 169941)


--- trunk/Source/WebCore/ChangeLog	2014-06-13 18:48:04 UTC (rev 169940)
+++ trunk/Source/WebCore/ChangeLog	2014-06-13 18:56:29 UTC (rev 169941)
@@ -1,3 +1,18 @@
+2014-06-13  Anders Carlsson  <ander...@apple.com>
+
+        Add a HTTPHeaderMap::find overload that takes a HTTPHeaderName
+        https://bugs.webkit.org/show_bug.cgi?id=133872
+
+        Reviewed by Andreas Kling.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::responseReceived):
+        * platform/network/HTTPHeaderMap.cpp:
+        (WebCore::HTTPHeaderMap::get):
+        (WebCore::HTTPHeaderMap::find):
+        * platform/network/HTTPHeaderMap.h:
+        * platform/network/HTTPHeaderNames.in:
+
 2014-06-13  Frédéric Wang  <fred.w...@free.fr>
 
         Draw radicals with glyphs for better rendering

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (169940 => 169941)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2014-06-13 18:48:04 UTC (rev 169940)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2014-06-13 18:56:29 UTC (rev 169941)
@@ -46,6 +46,7 @@
 #include "FrameTree.h"
 #include "HTMLFormElement.h"
 #include "HTMLFrameOwnerElement.h"
+#include "HTTPHeaderNames.h"
 #include "HistoryItem.h"
 #include "IconController.h"
 #include "InspectorInstrumentation.h"
@@ -604,7 +605,7 @@
     if (willLoadFallback)
         return;
 
-    auto it = response.httpHeaderFields().find("x-frame-options");
+    auto it = response.httpHeaderFields().find(HTTPHeaderName::XFrameOptions);
     if (it != response.httpHeaderFields().end()) {
         String content = it->value;
         ASSERT(m_mainResource);

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp (169940 => 169941)


--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2014-06-13 18:48:04 UTC (rev 169940)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp	2014-06-13 18:56:29 UTC (rev 169941)
@@ -106,15 +106,15 @@
 
 String HTTPHeaderMap::get(const char* name) const
 {
-    auto it = find(name);
+    auto it = m_headers.find<CaseFoldingCStringTranslator>(name);
     if (it == end())
         return String();
     return it->value;
 }
 
-HTTPHeaderMap::const_iterator HTTPHeaderMap::find(const char* name) const
+HTTPHeaderMap::const_iterator HTTPHeaderMap::find(HTTPHeaderName name) const
 {
-    return m_headers.find<CaseFoldingCStringTranslator>(name);
+    return m_headers.find(httpHeaderNameString(name).toStringWithoutCopying());
 }
 
 bool HTTPHeaderMap::remove(HTTPHeaderName name)

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.h (169940 => 169941)


--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.h	2014-06-13 18:48:04 UTC (rev 169940)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.h	2014-06-13 18:56:29 UTC (rev 169941)
@@ -65,11 +65,12 @@
 
     bool contains(HTTPHeaderName) const;
     String get(const char*) const;
-    const_iterator find(const char*) const;
+    const_iterator find(HTTPHeaderName) const;
     bool remove(HTTPHeaderName);
 
     // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
     template<size_t length> bool contains(const char (&)[length]) = delete;
+    template<size_t length> const_iterator find(const char(&)[length]) = delete;
     template<size_t length> bool remove(const char (&)[length]) = delete;
 
     const_iterator begin() const { return m_headers.begin(); }

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderNames.in (169940 => 169941)


--- trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2014-06-13 18:48:04 UTC (rev 169940)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2014-06-13 18:56:29 UTC (rev 169941)
@@ -35,4 +35,5 @@
 Location
 Origin
 Referer
-User-Agent
\ No newline at end of file
+User-Agent
+X-Frame-Options
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to