Diff
Modified: trunk/Source/WebCore/ChangeLog (169936 => 169937)
--- trunk/Source/WebCore/ChangeLog 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/ChangeLog 2014-06-13 17:33:45 UTC (rev 169937)
@@ -1,3 +1,42 @@
+2014-06-12 Anders Carlsson <[email protected]>
+
+ Add overloads of HTTPHeaderMap::find and remove that take enums
+ https://bugs.webkit.org/show_bug.cgi?id=133823
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.exp.in:
+ Update symbols.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Make HTTPHeaderNames.h private.
+
+ * platform/network/HTTPHeaderMap.cpp:
+ (WebCore::HTTPHeaderMap::contains):
+ Convert the enum value to a string and call the contains overload that takes a string.
+
+ (WebCore::HTTPHeaderMap::remove):
+ Convert the enum value to a string and call the remove overload that takes a string.
+
+ * platform/network/HTTPHeaderMap.h:
+ Add new overloads taking HTTPHeaderName and mark the versions taking string literals as deleted.
+
+ * platform/network/HTTPHeaderNames.in:
+ Add new header names.
+
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::clearHTTPAuthorization):
+ (WebCore::ResourceRequestBase::clearHTTPContentType):
+ (WebCore::ResourceRequestBase::clearHTTPReferrer):
+ (WebCore::ResourceRequestBase::clearHTTPOrigin):
+ (WebCore::ResourceRequestBase::clearHTTPUserAgent):
+ (WebCore::ResourceRequestBase::clearHTTPAccept):
+ Update functions to use HTTPHeaderName enums.
+
+ (WebCore::ResourceRequestBase::isConditional):
+ (WebCore::ResourceRequestBase::makeUnconditional):
+ Simplify these.
+
2014-06-13 Jarek Czekalski <[email protected]>
[ATK] Fix text inside "span" block in "a" block was not accessible.
Modified: trunk/Source/WebCore/WebCore.exp.in (169936 => 169937)
--- trunk/Source/WebCore/WebCore.exp.in 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-06-13 17:33:45 UTC (rev 169937)
@@ -291,7 +291,7 @@
__ZN7WebCore13GraphicsLayerD2Ev
__ZN7WebCore13HTTPHeaderMap3addERKN3WTF12AtomicStringERKNS1_6StringE
__ZN7WebCore13HTTPHeaderMap3setERKN3WTF12AtomicStringERKNS1_6StringE
-__ZN7WebCore13HTTPHeaderMap6removeEPKc
+__ZN7WebCore13HTTPHeaderMap6removeENS_14HTTPHeaderNameE
__ZN7WebCore13HTTPHeaderMapC1Ev
__ZN7WebCore13HTTPHeaderMapD1Ev
__ZN7WebCore13HitTestResultC1ERKNS_11LayoutPointE
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169936 => 169937)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-06-13 17:33:45 UTC (rev 169937)
@@ -790,6 +790,7 @@
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */; };
1AB33DA512551E320024457A /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AB33DA412551E320024457A /* IOKit.framework */; };
1AB5EBD0194A1D170059AC70 /* ShapeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB5EBCF194A1D170059AC70 /* ShapeValue.cpp */; };
+ 1AB5EBD2194A50F30059AC70 /* HTTPHeaderNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC900C21943C0A0008625B5 /* HTTPHeaderNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */; };
1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */; };
1AB7FC6B0A8B92EC00D9D37B /* XPathExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC4A0A8B92EC00D9D37B /* XPathExpression.cpp */; };
@@ -26356,6 +26357,7 @@
CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */,
CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */,
BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */,
+ 1AB5EBD2194A50F30059AC70 /* HTTPHeaderNames.h in Headers */,
93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
3140379B124BEA7F00AF40E4 /* WebCoreMotionManager.h in Headers */,
934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */,
Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp (169936 => 169937)
--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp 2014-06-13 17:33:45 UTC (rev 169937)
@@ -31,7 +31,9 @@
#include "config.h"
#include "HTTPHeaderMap.h"
+#include "HTTPHeaderNames.h"
#include <utility>
+#include <wtf/text/StringView.h>
namespace WebCore {
@@ -97,6 +99,11 @@
}
};
+bool HTTPHeaderMap::contains(HTTPHeaderName name) const
+{
+ return m_headers.contains(httpHeaderNameString(name).toStringWithoutCopying());
+}
+
String HTTPHeaderMap::get(const char* name) const
{
auto it = find(name);
@@ -104,20 +111,15 @@
return String();
return it->value;
}
-
-bool HTTPHeaderMap::contains(const char* name) const
-{
- return find(name) != end();
-}
HTTPHeaderMap::const_iterator HTTPHeaderMap::find(const char* name) const
{
return m_headers.find<CaseFoldingCStringTranslator>(name);
}
-bool HTTPHeaderMap::remove(const char* name)
+bool HTTPHeaderMap::remove(HTTPHeaderName name)
{
- return m_headers.remove(m_headers.find<CaseFoldingCStringTranslator>(name));
+ return m_headers.remove(httpHeaderNameString(name).toStringWithoutCopying());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/HTTPHeaderMap.h (169936 => 169937)
--- trunk/Source/WebCore/platform/network/HTTPHeaderMap.h 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderMap.h 2014-06-13 17:33:45 UTC (rev 169937)
@@ -36,6 +36,8 @@
namespace WebCore {
+enum class HTTPHeaderName;
+
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.
@@ -58,16 +60,18 @@
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);
- // Alternate accessors that are faster than converting the char* to AtomicString first.
- bool contains(const char*) const;
+ bool contains(HTTPHeaderName) const;
String get(const char*) const;
const_iterator find(const char*) const;
- bool remove(const char*);
+ 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> bool remove(const char (&)[length]) = delete;
+
const_iterator begin() const { return m_headers.begin(); }
const_iterator end() const { return m_headers.end(); }
@@ -82,7 +86,7 @@
}
private:
- HashMap<AtomicString, String, CaseFoldingHash> m_headers;
+ HashMapType m_headers;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/HTTPHeaderNames.in (169936 => 169937)
--- trunk/Source/WebCore/platform/network/HTTPHeaderNames.in 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderNames.in 2014-06-13 17:33:45 UTC (rev 169937)
@@ -24,4 +24,15 @@
//
Accept
+Authorization
+Content-Length
+Content-Type
+If-Match
+If-Modified-Since
+If-None-Match
+If-Range
+If-Unmodified-Since
Location
+Origin
+Referer
+User-Agent
\ No newline at end of file
Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (169936 => 169937)
--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2014-06-13 17:33:45 UTC (rev 169937)
@@ -26,6 +26,7 @@
#include "config.h"
#include "ResourceRequestBase.h"
+#include "HTTPHeaderNames.h"
#include "ResourceRequest.h"
#include <wtf/PassOwnPtr.h>
@@ -264,7 +265,7 @@
{
updateResourceRequest();
- if (!m_httpHeaderFields.remove("Authorization"))
+ if (!m_httpHeaderFields.remove(HTTPHeaderName::Authorization))
return;
if (url().protocolIsInHTTPFamily())
@@ -285,7 +286,7 @@
{
updateResourceRequest();
- m_httpHeaderFields.remove("Content-Type");
+ m_httpHeaderFields.remove(HTTPHeaderName::ContentType);
if (url().protocolIsInHTTPFamily())
m_platformRequestUpdated = false;
@@ -305,7 +306,7 @@
{
updateResourceRequest();
- m_httpHeaderFields.remove("Referer");
+ m_httpHeaderFields.remove(HTTPHeaderName::Referer);
if (url().protocolIsInHTTPFamily())
m_platformRequestUpdated = false;
@@ -325,7 +326,7 @@
{
updateResourceRequest();
- m_httpHeaderFields.remove("Origin");
+ m_httpHeaderFields.remove(HTTPHeaderName::Origin);
if (url().protocolIsInHTTPFamily())
m_platformRequestUpdated = false;
@@ -345,7 +346,7 @@
{
updateResourceRequest();
- m_httpHeaderFields.remove("User-Agent");
+ m_httpHeaderFields.remove(HTTPHeaderName::UserAgent);
if (url().protocolIsInHTTPFamily())
m_platformRequestUpdated = false;
@@ -365,7 +366,7 @@
{
updateResourceRequest();
- m_httpHeaderFields.remove("Accept");
+ m_httpHeaderFields.remove(HTTPHeaderName::Accept);
if (url().protocolIsInHTTPFamily())
m_platformRequestUpdated = false;
@@ -511,22 +512,28 @@
return ResourceRequest::platformCompare(a, b);
}
+static const HTTPHeaderName conditionalHeaderNames[] = {
+ HTTPHeaderName::IfMatch,
+ HTTPHeaderName::IfModifiedSince,
+ HTTPHeaderName::IfNoneMatch,
+ HTTPHeaderName::IfRange,
+ HTTPHeaderName::IfUnmodifiedSince
+};
+
bool ResourceRequestBase::isConditional() const
{
- return (m_httpHeaderFields.contains("If-Match") ||
- m_httpHeaderFields.contains("If-Modified-Since") ||
- m_httpHeaderFields.contains("If-None-Match") ||
- m_httpHeaderFields.contains("If-Range") ||
- m_httpHeaderFields.contains("If-Unmodified-Since"));
+ for (auto headerName : conditionalHeaderNames) {
+ if (m_httpHeaderFields.contains(headerName))
+ return true;
+ }
+
+ return false;
}
void ResourceRequestBase::makeUnconditional()
{
- m_httpHeaderFields.remove("If-Match");
- m_httpHeaderFields.remove("If-Modified-Since");
- m_httpHeaderFields.remove("If-None-Match");
- m_httpHeaderFields.remove("If-Range");
- m_httpHeaderFields.remove("If-Unmodified-Since");
+ for (auto headerName : conditionalHeaderNames)
+ m_httpHeaderFields.remove(headerName);
}
double ResourceRequestBase::defaultTimeoutInterval()
Modified: trunk/Source/WebCore/plugins/PluginView.cpp (169936 => 169937)
--- trunk/Source/WebCore/plugins/PluginView.cpp 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebCore/plugins/PluginView.cpp 2014-06-13 17:33:45 UTC (rev 169937)
@@ -44,6 +44,7 @@
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HTMLPlugInElement.h"
+#include "HTTPHeaderNames.h"
#include "Image.h"
#include "JSDOMBinding.h"
#include "JSDOMWindow.h"
@@ -1165,7 +1166,7 @@
if (!contentLength.isNull())
dataLength = min(contentLength.toInt(), (int)dataLength);
- headerFields.remove("Content-Length");
+ headerFields.remove(HTTPHeaderName::ContentLength);
postData += location;
postDataLength = dataLength;
Modified: trunk/Source/WebKit2/ChangeLog (169936 => 169937)
--- trunk/Source/WebKit2/ChangeLog 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-13 17:33:45 UTC (rev 169937)
@@ -1,3 +1,14 @@
+2014-06-12 Anders Carlsson <[email protected]>
+
+ Add overloads of HTTPHeaderMap::find and remove that take enums
+ https://bugs.webkit.org/show_bug.cgi?id=133823
+
+ Reviewed by Sam Weinig.
+
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::parsePostBuffer):
+ Update for WebCore changes.
+
2014-06-12 Benjamin Poulain <[email protected]>
[iOS][WK2] Do not update the viewport configuration on load until the first viewport arguments is received
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (169936 => 169937)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2014-06-13 16:12:27 UTC (rev 169936)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2014-06-13 17:33:45 UTC (rev 169937)
@@ -32,6 +32,7 @@
#include "NetscapePlugin.h"
#include "PluginController.h"
#include <WebCore/HTTPHeaderMap.h>
+#include <WebCore/HTTPHeaderNames.h>
#include <WebCore/IdentifierRep.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/ProtectionSpace.h>
@@ -249,11 +250,10 @@
if (!contentLength.isNull())
dataLength = std::min(contentLength.toInt(), (int)dataLength);
- headerFields.remove("Content-Length");
+ headerFields.remove(HTTPHeaderName::ContentLength);
postBuffer += location;
postBufferSize = dataLength;
-
}
}
}