<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170021] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170021">170021</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-06-16 12:26:49 -0700 (Mon, 16 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add HTTPHeaderName overloads on ResourceResponseBase
https://bugs.webkit.org/show_bug.cgi?id=133946
Reviewed by Andreas Kling.
Source/WebCore:
* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::lastModified):
* loader/CrossOriginAccessControl.cpp:
(WebCore::passesAccessControlCheck):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCacheItem::parse):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::didBeginDocument):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::createResourceHandle):
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::canUseSheet):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::mimeType):
* platform/network/HTTPHeaderNames.in:
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::httpHeaderField):
(WebCore::ResourceResponseBase::setHTTPHeaderField):
* platform/network/ResourceResponseBase.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::getAllResponseHeaders):
(WebCore::XMLHttpRequest::getResponseHeader):
(WebCore::XMLHttpRequest::responseMIMEType):
(WebCore::XMLHttpRequest::didReceiveResponse):
Source/WebKit2:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::buildHTTPHeaders):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderCrossOriginAccessControlcpp">trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderCrossOriginPreflightResultCachecpp">trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp">trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedScriptcpp">trunk/Source/WebCore/loader/cache/CachedScript.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePerformanceResourceTimingcpp">trunk/Source/WebCore/page/PerformanceResourceTiming.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkHTTPHeaderNamesin">trunk/Source/WebCore/platform/network/HTTPHeaderNames.in</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBasecpp">trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceResponseSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp</a></li>
<li><a href="#trunkSourceWebCorepluginsPluginStreamcpp">trunk/Source/WebCore/plugins/PluginStream.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginViewcpp">trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/ChangeLog        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-06-16 Anders Carlsson <andersca@apple.com>
+
+ Add HTTPHeaderName overloads on ResourceResponseBase
+ https://bugs.webkit.org/show_bug.cgi?id=133946
+
+ Reviewed by Andreas Kling.
+
+ * WebCore.exp.in:
+ * dom/Document.cpp:
+ (WebCore::Document::lastModified):
+ * loader/CrossOriginAccessControl.cpp:
+ (WebCore::passesAccessControlCheck):
+ * loader/CrossOriginPreflightResultCache.cpp:
+ (WebCore::CrossOriginPreflightResultCacheItem::parse):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::receivedFirstData):
+ (WebCore::FrameLoader::didBeginDocument):
+ * loader/appcache/ApplicationCacheGroup.cpp:
+ (WebCore::ApplicationCacheGroup::createResourceHandle):
+ * loader/cache/CachedCSSStyleSheet.cpp:
+ (WebCore::CachedCSSStyleSheet::canUseSheet):
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::load):
+ * loader/cache/CachedScript.cpp:
+ (WebCore::CachedScript::mimeType):
+ * platform/network/HTTPHeaderNames.in:
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::ResourceResponseBase::httpHeaderField):
+ (WebCore::ResourceResponseBase::setHTTPHeaderField):
+ * platform/network/ResourceResponseBase.h:
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::getAllResponseHeaders):
+ (WebCore::XMLHttpRequest::getResponseHeader):
+ (WebCore::XMLHttpRequest::responseMIMEType):
+ (WebCore::XMLHttpRequest::didReceiveResponse):
+
</ins><span class="cx"> 2014-04-05 Antonio Gomes <a1.gomes@sisa.samsung.com>
</span><span class="cx">
</span><span class="cx"> [Bindings] "nullable" sequence support is incomplete (i.e. sequence<NativeType>?)
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -1796,7 +1796,7 @@
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase12lastModifiedEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
</span><del>-__ZNK7WebCore20ResourceResponseBase15httpHeaderFieldEPKc
</del><ins>+__ZNK7WebCore20ResourceResponseBase15httpHeaderFieldENS_14HTTPHeaderNameE
</ins><span class="cx"> __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -3907,7 +3907,7 @@
</span><span class="cx"> if (m_frame) {
</span><span class="cx"> String httpLastModified;
</span><span class="cx"> if (DocumentLoader* documentLoader = loader())
</span><del>- httpLastModified = documentLoader->response().httpHeaderField("Last-Modified");
</del><ins>+ httpLastModified = documentLoader->response().httpHeaderField(HTTPHeaderName::LastModified);
</ins><span class="cx"> if (!httpLastModified.isEmpty()) {
</span><span class="cx"> date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified));
</span><span class="cx"> foundDate = true;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderCrossOriginAccessControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx"> {
</span><span class="cx"> // A wildcard Access-Control-Allow-Origin can not be used if credentials are to be sent,
</span><span class="cx"> // even with Access-Control-Allow-Credentials set to true.
</span><del>- const String& accessControlOriginString = response.httpHeaderField("access-control-allow-origin");
</del><ins>+ const String& accessControlOriginString = response.httpHeaderField(HTTPHeaderName::AccessControlAllowOrigin);
</ins><span class="cx"> if (accessControlOriginString == "*" && includeCredentials == DoNotAllowStoredCredentials)
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (includeCredentials == AllowStoredCredentials) {
</span><del>- const String& accessControlCredentialsString = response.httpHeaderField("access-control-allow-credentials");
</del><ins>+ const String& accessControlCredentialsString = response.httpHeaderField(HTTPHeaderName::AccessControlAllowCredentials);
</ins><span class="cx"> if (accessControlCredentialsString != "true") {
</span><span class="cx"> errorDescription = "Credentials flag is true, but Access-Control-Allow-Credentials is not \"true\".";
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderCrossOriginPreflightResultCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #include "CrossOriginPreflightResultCache.h"
</span><span class="cx">
</span><span class="cx"> #include "CrossOriginAccessControl.h"
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "ResourceResponse.h"
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="lines">@@ -92,19 +93,19 @@
</span><span class="cx"> bool CrossOriginPreflightResultCacheItem::parse(const ResourceResponse& response, String& errorDescription)
</span><span class="cx"> {
</span><span class="cx"> m_methods.clear();
</span><del>- if (!parseAccessControlAllowList(response.httpHeaderField("Access-Control-Allow-Methods"), m_methods)) {
</del><ins>+ if (!parseAccessControlAllowList(response.httpHeaderField(HTTPHeaderName::AccessControlAllowMethods), m_methods)) {
</ins><span class="cx"> errorDescription = "Cannot parse Access-Control-Allow-Methods response header field.";
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_headers.clear();
</span><del>- if (!parseAccessControlAllowList(response.httpHeaderField("Access-Control-Allow-Headers"), m_headers)) {
</del><ins>+ if (!parseAccessControlAllowList(response.httpHeaderField(HTTPHeaderName::AccessControlAllowHeaders), m_headers)) {
</ins><span class="cx"> errorDescription = "Cannot parse Access-Control-Allow-Headers response header field.";
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::chrono::seconds expiryDelta;
</span><del>- if (parseAccessControlMaxAge(response.httpHeaderField("Access-Control-Max-Age"), expiryDelta)) {
</del><ins>+ if (parseAccessControlMaxAge(response.httpHeaderField(HTTPHeaderName::AccessControlMaxAge), expiryDelta)) {
</ins><span class="cx"> if (expiryDelta > maxPreflightCacheTimeout)
</span><span class="cx"> expiryDelta = maxPreflightCacheTimeout;
</span><span class="cx"> } else
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -668,7 +668,7 @@
</span><span class="cx">
</span><span class="cx"> double delay;
</span><span class="cx"> String urlString;
</span><del>- if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField("Refresh"), false, delay, urlString))
</del><ins>+ if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField(HTTPHeaderName::Refresh), false, delay, urlString))
</ins><span class="cx"> return;
</span><span class="cx"> URL completedURL;
</span><span class="cx"> if (urlString.isEmpty())
</span><span class="lines">@@ -712,27 +712,27 @@
</span><span class="cx"> m_frame.document()->cachedResourceLoader()->setAutoLoadImages(settings.loadsImagesAutomatically());
</span><span class="cx">
</span><span class="cx"> if (m_documentLoader) {
</span><del>- String dnsPrefetchControl = m_documentLoader->response().httpHeaderField("X-DNS-Prefetch-Control");
</del><ins>+ String dnsPrefetchControl = m_documentLoader->response().httpHeaderField(HTTPHeaderName::XDNSPrefetchControl);
</ins><span class="cx"> if (!dnsPrefetchControl.isEmpty())
</span><span class="cx"> m_frame.document()->parseDNSPrefetchControlHeader(dnsPrefetchControl);
</span><span class="cx">
</span><del>- String policyValue = m_documentLoader->response().httpHeaderField("Content-Security-Policy");
</del><ins>+ String policyValue = m_documentLoader->response().httpHeaderField(HTTPHeaderName::ContentSecurityPolicy);
</ins><span class="cx"> if (!policyValue.isEmpty())
</span><span class="cx"> m_frame.document()->contentSecurityPolicy()->didReceiveHeader(policyValue, ContentSecurityPolicy::Enforce);
</span><span class="cx">
</span><del>- policyValue = m_documentLoader->response().httpHeaderField("Content-Security-Policy-Report-Only");
</del><ins>+ policyValue = m_documentLoader->response().httpHeaderField(HTTPHeaderName::ContentSecurityPolicyReportOnly);
</ins><span class="cx"> if (!policyValue.isEmpty())
</span><span class="cx"> m_frame.document()->contentSecurityPolicy()->didReceiveHeader(policyValue, ContentSecurityPolicy::Report);
</span><span class="cx">
</span><del>- policyValue = m_documentLoader->response().httpHeaderField("X-WebKit-CSP");
</del><ins>+ policyValue = m_documentLoader->response().httpHeaderField(HTTPHeaderName::XWebKitCSP);
</ins><span class="cx"> if (!policyValue.isEmpty())
</span><span class="cx"> m_frame.document()->contentSecurityPolicy()->didReceiveHeader(policyValue, ContentSecurityPolicy::PrefixedEnforce);
</span><span class="cx">
</span><del>- policyValue = m_documentLoader->response().httpHeaderField("X-WebKit-CSP-Report-Only");
</del><ins>+ policyValue = m_documentLoader->response().httpHeaderField(HTTPHeaderName::XWebKitCSPReportOnly);
</ins><span class="cx"> if (!policyValue.isEmpty())
</span><span class="cx"> m_frame.document()->contentSecurityPolicy()->didReceiveHeader(policyValue, ContentSecurityPolicy::PrefixedReport);
</span><span class="cx">
</span><del>- String headerContentLanguage = m_documentLoader->response().httpHeaderField("Content-Language");
</del><ins>+ String headerContentLanguage = m_documentLoader->response().httpHeaderField(HTTPHeaderName::ContentLanguage);
</ins><span class="cx"> if (!headerContentLanguage.isEmpty()) {
</span><span class="cx"> size_t commaIndex = headerContentLanguage.find(',');
</span><span class="cx"> headerContentLanguage.truncate(commaIndex); // notFound == -1 == don't truncate
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -484,8 +484,8 @@
</span><span class="cx"> request.setHTTPHeaderField(HTTPHeaderName::CacheControl, "max-age=0");
</span><span class="cx">
</span><span class="cx"> if (newestCachedResource) {
</span><del>- const String& lastModified = newestCachedResource->response().httpHeaderField("Last-Modified");
- const String& eTag = newestCachedResource->response().httpHeaderField("ETag");
</del><ins>+ const String& lastModified = newestCachedResource->response().httpHeaderField(HTTPHeaderName::LastModified);
+ const String& eTag = newestCachedResource->response().httpHeaderField(HTTPHeaderName::ETag);
</ins><span class="cx"> if (!lastModified.isEmpty() || !eTag.isEmpty()) {
</span><span class="cx"> if (!lastModified.isEmpty())
</span><span class="cx"> request.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "CSSStyleSheet.h"
</span><span class="cx"> #include "CachedResourceClientWalker.h"
</span><span class="cx"> #include "CachedStyleSheetClient.h"
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "HTTPParsers.h"
</span><span class="cx"> #include "MemoryCache.h"
</span><span class="cx"> #include "ResourceBuffer.h"
</span><span class="lines">@@ -129,7 +130,7 @@
</span><span class="cx"> //
</span><span class="cx"> // This code defaults to allowing the stylesheet for non-HTTP protocols so
</span><span class="cx"> // folks can use standards mode for local HTML documents.
</span><del>- String mimeType = extractMIMETypeFromMediaType(response().httpHeaderField("Content-Type"));
</del><ins>+ String mimeType = extractMIMETypeFromMediaType(response().httpHeaderField(HTTPHeaderName::ContentType));
</ins><span class="cx"> bool typeOK = mimeType.isEmpty() || equalIgnoringCase(mimeType, "text/css") || equalIgnoringCase(mimeType, "application/x-unknown-content-type");
</span><span class="cx"> if (hasValidMIMEType)
</span><span class="cx"> *hasValidMIMEType = typeOK;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -283,8 +283,8 @@
</span><span class="cx"> CachedResource* resourceToRevalidate = m_resourceToRevalidate;
</span><span class="cx"> ASSERT(resourceToRevalidate->canUseCacheValidator());
</span><span class="cx"> ASSERT(resourceToRevalidate->isLoaded());
</span><del>- const String& lastModified = resourceToRevalidate->response().httpHeaderField("Last-Modified");
- const String& eTag = resourceToRevalidate->response().httpHeaderField("ETag");
</del><ins>+ const String& lastModified = resourceToRevalidate->response().httpHeaderField(HTTPHeaderName::LastModified);
+ const String& eTag = resourceToRevalidate->response().httpHeaderField(HTTPHeaderName::ETag);
</ins><span class="cx"> if (!lastModified.isEmpty() || !eTag.isEmpty()) {
</span><span class="cx"> ASSERT(cachedResourceLoader->cachePolicy(type()) != CachePolicyReload);
</span><span class="cx"> if (cachedResourceLoader->cachePolicy(type()) == CachePolicyRevalidate)
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedScript.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedScript.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/loader/cache/CachedScript.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CachedResourceClient.h"
</span><span class="cx"> #include "CachedResourceClientWalker.h"
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "HTTPParsers.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="cx"> #include "MemoryCache.h"
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx">
</span><span class="cx"> String CachedScript::mimeType() const
</span><span class="cx"> {
</span><del>- return extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type")).lower();
</del><ins>+ return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPHeaderName::ContentType)).lower();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const String& CachedScript::script()
</span></span></pre></div>
<a id="trunkSourceWebCorepagePerformanceResourceTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "DocumentLoadTiming.h"
</span><span class="cx"> #include "DocumentLoader.h"
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "URL.h"
</span><span class="cx"> #include "ResourceRequest.h"
</span><span class="cx"> #include "ResourceResponse.h"
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx"> if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin()))
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- const String& timingAllowOriginString = response.httpHeaderField("timing-allow-origin");
</del><ins>+ const String& timingAllowOriginString = response.httpHeaderField(HTTPHeaderName::TimingAllowOrigin);
</ins><span class="cx"> if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOriginString, "null"))
</span><span class="cx"> return false;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkHTTPHeaderNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/HTTPHeaderNames.in (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/HTTPHeaderNames.in        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderNames.in        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -24,6 +24,12 @@
</span><span class="cx"> //
</span><span class="cx">
</span><span class="cx"> Accept
</span><ins>+Access-Control-Allow-Credentials
+Access-Control-Allow-Headers
+Access-Control-Allow-Methods
+Access-Control-Allow-Origin
+Access-Control-Expose-Headers
+Access-Control-Max-Age
</ins><span class="cx"> Access-Control-Request-Headers
</span><span class="cx"> Access-Control-Request-Method
</span><span class="cx"> Age
</span><span class="lines">@@ -31,6 +37,7 @@
</span><span class="cx"> Cache-Control
</span><span class="cx"> Connection
</span><span class="cx"> Content-Disposition
</span><ins>+Content-Encoding
</ins><span class="cx"> Content-Language
</span><span class="cx"> Content-Length
</span><span class="cx"> Content-Security-Policy
</span><span class="lines">@@ -65,6 +72,7 @@
</span><span class="cx"> Sec-WebSocket-Version
</span><span class="cx"> Set-Cookie
</span><span class="cx"> Set-Cookie2
</span><ins>+Timing-Allow-Origin
</ins><span class="cx"> Upgrade
</span><span class="cx"> User-Agent
</span><span class="cx"> X-DNS-Prefetch-Control
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -273,7 +273,7 @@
</span><span class="cx"> return m_httpHeaderFields.get(name);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-String ResourceResponseBase::httpHeaderField(const char* name) const
</del><ins>+String ResourceResponseBase::httpHeaderField(HTTPHeaderName name) const
</ins><span class="cx"> {
</span><span class="cx"> lazyInit(CommonFieldsOnly);
</span><span class="cx">
</span><span class="lines">@@ -329,6 +329,17 @@
</span><span class="cx"> // FIXME: Should invalidate or update platform response if present.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ResourceResponseBase::setHTTPHeaderField(HTTPHeaderName name, const String& value)
+{
+ lazyInit(CommonAndUncommonFields);
+
+ updateHeaderParsedState(name);
+
+ m_httpHeaderFields.set(name, value);
+
+ // FIXME: Should invalidate or update platform response if present.
+}
+
</ins><span class="cx"> void ResourceResponseBase::addHTTPHeaderField(const AtomicString& name, const String& value)
</span><span class="cx"> {
</span><span class="cx"> lazyInit(CommonAndUncommonFields);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -77,13 +77,21 @@
</span><span class="cx">
</span><span class="cx"> const String& httpStatusText() const;
</span><span class="cx"> void setHTTPStatusText(const String&);
</span><del>-
</del><ins>+
+ const HTTPHeaderMap& httpHeaderFields() const;
+
</ins><span class="cx"> String httpHeaderField(const AtomicString& name) const;
</span><del>- String httpHeaderField(const char* name) const;
</del><ins>+ String httpHeaderField(HTTPHeaderName) const;
</ins><span class="cx"> void setHTTPHeaderField(const AtomicString& name, const String& value);
</span><ins>+ void setHTTPHeaderField(HTTPHeaderName, const String& value);
+
</ins><span class="cx"> void addHTTPHeaderField(const AtomicString& name, const String& value);
</span><del>- const HTTPHeaderMap& httpHeaderFields() const;
</del><span class="cx">
</span><ins>+ // 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;
+ template<size_t length> void setHTTPHeaderField(const char (&)[length], const String&) = delete;
+ template<size_t length> void addHTTPHeaderField(const char (&)[length], const String&) = delete;
+
</ins><span class="cx"> bool isMultipart() const { return mimeType() == "multipart/x-mixed-replace"; }
</span><span class="cx">
</span><span class="cx"> bool isAttachment() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceResponseSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">
</span><span class="cx"> #include "ResourceResponse.h"
</span><span class="cx">
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "HTTPParsers.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="lines">@@ -98,7 +99,7 @@
</span><span class="cx"> setTextEncodingName(extractCharsetFromMediaType(contentType));
</span><span class="cx">
</span><span class="cx"> setExpectedContentLength(soup_message_headers_get_content_length(headers));
</span><del>- setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition")));}
</del><ins>+ setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition)));}
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepluginsPluginStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/plugins/PluginStream.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/plugins/PluginStream.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/plugins/PluginStream.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "DocumentLoader.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameLoader.h"
</span><ins>+#include "HTTPHeaderNames.h"
</ins><span class="cx"> #include "PluginDebug.h"
</span><span class="cx"> #include "ResourceLoadScheduler.h"
</span><span class="cx"> #include "SharedBuffer.h"
</span><span class="lines">@@ -168,7 +169,7 @@
</span><span class="cx"> // If the content is encoded (most likely compressed), then don't send its length to the plugin,
</span><span class="cx"> // which is only interested in the decoded length, not yet known at the moment.
</span><span class="cx"> // <rdar://problem/4470599> tracks a request for -[NSURLResponse expectedContentLength] to incorporate this logic.
</span><del>- String contentEncoding = m_resourceResponse.httpHeaderField("Content-Encoding");
</del><ins>+ String contentEncoding = m_resourceResponse.httpHeaderField(HTTPHeaderName::ContentEncoding);
</ins><span class="cx"> if (!contentEncoding.isNull() && contentEncoding != "identity")
</span><span class="cx"> expectedContentLength = -1;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -964,7 +964,7 @@
</span><span class="cx"> StringBuilder stringBuilder;
</span><span class="cx">
</span><span class="cx"> HTTPHeaderSet accessControlExposeHeaderSet;
</span><del>- parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField("Access-Control-Expose-Headers"), accessControlExposeHeaderSet);
</del><ins>+ parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField(HTTPHeaderName::AccessControlExposeHeaders), accessControlExposeHeaderSet);
</ins><span class="cx">
</span><span class="cx"> for (const auto& header : m_response.httpHeaderFields()) {
</span><span class="cx"> // Hide Set-Cookie header fields from the XMLHttpRequest client for these reasons:
</span><span class="lines">@@ -1002,7 +1002,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HTTPHeaderSet accessControlExposeHeaderSet;
</span><del>- parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField("Access-Control-Expose-Headers"), accessControlExposeHeaderSet);
</del><ins>+ parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField(HTTPHeaderName::AccessControlExposeHeaders), accessControlExposeHeaderSet);
</ins><span class="cx">
</span><span class="cx"> if (!m_sameOriginRequest && !isOnAccessControlResponseHeaderWhitelist(name) && !accessControlExposeHeaderSet.contains(name)) {
</span><span class="cx"> logConsoleError(scriptExecutionContext(), "Refused to get unsafe header \"" + name + "\"");
</span><span class="lines">@@ -1016,7 +1016,7 @@
</span><span class="cx"> String mimeType = extractMIMETypeFromMediaType(m_mimeTypeOverride);
</span><span class="cx"> if (mimeType.isEmpty()) {
</span><span class="cx"> if (m_response.isHTTP())
</span><del>- mimeType = extractMIMETypeFromMediaType(m_response.httpHeaderField("Content-Type"));
</del><ins>+ mimeType = extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPHeaderName::ContentType));
</ins><span class="cx"> else
</span><span class="cx"> mimeType = m_response.mimeType();
</span><span class="cx"> }
</span><span class="lines">@@ -1136,7 +1136,7 @@
</span><span class="cx">
</span><span class="cx"> m_response = response;
</span><span class="cx"> if (!m_mimeTypeOverride.isEmpty()) {
</span><del>- m_response.setHTTPHeaderField("Content-Type", m_mimeTypeOverride);
</del><ins>+ m_response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_mimeTypeOverride);
</ins><span class="cx"> m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-06-16 Anders Carlsson <andersca@apple.com>
+
+ Add HTTPHeaderName overloads on ResourceResponseBase
+ https://bugs.webkit.org/show_bug.cgi?id=133946
+
+ Reviewed by Andreas Kling.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::buildHTTPHeaders):
+
</ins><span class="cx"> 2014-06-16 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Fixed a typo in the last change.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (170020 => 170021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-06-16 19:26:05 UTC (rev 170020)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-06-16 19:26:49 UTC (rev 170021)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include <WebCore/GraphicsContext.h>
</span><span class="cx"> #include <WebCore/HTMLPlugInElement.h>
</span><span class="cx"> #include <WebCore/HTMLPlugInImageElement.h>
</span><ins>+#include <WebCore/HTTPHeaderNames.h>
</ins><span class="cx"> #include <WebCore/HostWindow.h>
</span><span class="cx"> #include <WebCore/MIMETypeRegistry.h>
</span><span class="cx"> #include <WebCore/MainFrame.h>
</span><span class="lines">@@ -193,7 +194,7 @@
</span><span class="cx"> // If the content is encoded (most likely compressed), then don't send its length to the plugin,
</span><span class="cx"> // which is only interested in the decoded length, not yet known at the moment.
</span><span class="cx"> // <rdar://problem/4470599> tracks a request for -[NSURLResponse expectedContentLength] to incorporate this logic.
</span><del>- String contentEncoding = response.httpHeaderField("Content-Encoding");
</del><ins>+ String contentEncoding = response.httpHeaderField(HTTPHeaderName::ContentEncoding);
</ins><span class="cx"> if (!contentEncoding.isNull() && contentEncoding != "identity")
</span><span class="cx"> expectedContentLength = -1;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>