<!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>[182064] trunk/Source/WebCore</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/182064">182064</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-03-27 09:49:21 -0700 (Fri, 27 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move CacheValidation to platform
https://bugs.webkit.org/show_bug.cgi?id=143133
Reviewed by Chris Dumez.
It deals with platform types only and is currently violating layering.
* WebCore.xcodeproj/project.pbxproj:
* loader/cache/CacheValidation.cpp: Removed.
* loader/cache/CacheValidation.h: Removed.
* platform/network/CacheValidation.cpp: Copied from Source/WebCore/loader/cache/CacheValidation.cpp.
* platform/network/CacheValidation.h: Copied from Source/WebCore/loader/cache/CacheValidation.h.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformnetworkCacheValidationcpp">trunk/Source/WebCore/platform/network/CacheValidation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkCacheValidationh">trunk/Source/WebCore/platform/network/CacheValidation.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreloadercacheCacheValidationcpp">trunk/Source/WebCore/loader/cache/CacheValidation.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCacheValidationh">trunk/Source/WebCore/loader/cache/CacheValidation.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -1888,7 +1888,6 @@
</span><span class="cx"> loader/cache/CachedSVGDocumentReference.cpp
</span><span class="cx"> loader/cache/CachedScript.cpp
</span><span class="cx"> loader/cache/CachedXSLStyleSheet.cpp
</span><del>- loader/cache/CacheValidation.cpp
</del><span class="cx"> loader/cache/MemoryCache.cpp
</span><span class="cx">
</span><span class="cx"> loader/icon/IconController.cpp
</span><span class="lines">@@ -2212,6 +2211,7 @@
</span><span class="cx"> platform/network/BlobRegistry.cpp
</span><span class="cx"> platform/network/BlobRegistryImpl.cpp
</span><span class="cx"> platform/network/BlobResourceHandle.cpp
</span><ins>+ platform/network/CacheValidation.cpp
</ins><span class="cx"> platform/network/CredentialBase.cpp
</span><span class="cx"> platform/network/CredentialStorage.cpp
</span><span class="cx"> platform/network/DNSResolveQueue.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/ChangeLog        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-27 Antti Koivisto <antti@apple.com>
+
+ Move CacheValidation to platform
+ https://bugs.webkit.org/show_bug.cgi?id=143133
+
+ Reviewed by Chris Dumez.
+
+ It deals with platform types only and is currently violating layering.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/cache/CacheValidation.cpp: Removed.
+ * loader/cache/CacheValidation.h: Removed.
+ * platform/network/CacheValidation.cpp: Copied from Source/WebCore/loader/cache/CacheValidation.cpp.
+ * platform/network/CacheValidation.h: Copied from Source/WebCore/loader/cache/CacheValidation.h.
+
</ins><span class="cx"> 2015-03-27 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r177896.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -7357,7 +7357,6 @@
</span><span class="cx"> <ClCompile Include="..\loader\cache\CachedSVGDocumentReference.cpp" />
</span><span class="cx"> <ClCompile Include="..\loader\cache\CachedTextTrack.cpp" />
</span><span class="cx"> <ClCompile Include="..\loader\cache\CachedXSLStyleSheet.cpp" />
</span><del>- <ClCompile Include="..\loader\cache\CacheValidation.cpp" />
</del><span class="cx"> <ClCompile Include="..\loader\cache\MemoryCache.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\audio\AudioHardwareListener.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\CalculationValue.cpp" />
</span><span class="lines">@@ -8680,6 +8679,7 @@
</span><span class="cx"> <ClCompile Include="..\platform\network\BlobResourceHandle.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\network\BlobRegistry.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\network\BlobRegistryImpl.cpp" />
</span><ins>+ <ClCompile Include="..\platform\network\CacheValidation.cpp" />
</ins><span class="cx"> <ClCompile Include="..\platform\network\CredentialBase.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\network\CredentialStorage.cpp" />
</span><span class="cx"> <ClCompile Include="..\platform\network\DataURL.cpp" />
</span><span class="lines">@@ -19421,7 +19421,6 @@
</span><span class="cx"> <ClInclude Include="..\loader\cache\CachedTextTrack.h" />
</span><span class="cx"> <ClInclude Include="..\loader\cache\CachedXSLStyleSheet.h" />
</span><span class="cx"> <ClInclude Include="..\loader\cache\CachePolicy.h" />
</span><del>- <ClInclude Include="..\loader\cache\CacheValidation.h" />
</del><span class="cx"> <ClInclude Include="..\loader\cache\MemoryCache.h" />
</span><span class="cx"> <ClInclude Include="..\platform\audio\AudioHardwareListener.h" />
</span><span class="cx"> <ClInclude Include="..\platform\CalculationValue.h" />
</span><span class="lines">@@ -19889,6 +19888,7 @@
</span><span class="cx"> <ClInclude Include="..\platform\network\BlobRegistryImpl.h" />
</span><span class="cx"> <ClInclude Include="..\platform\network\BlobResourceHandle.h" />
</span><span class="cx"> <ClInclude Include="..\platform\network\CookieStorage.h" />
</span><ins>+ <ClInclude Include="..\platform\network\CacheValidation.h" />
</ins><span class="cx"> <ClInclude Include="..\platform\network\Credential.h" />
</span><span class="cx"> <ClInclude Include="..\platform\network\CredentialBase.h" />
</span><span class="cx"> <ClInclude Include="..\platform\network\CredentialStorage.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -6206,6 +6206,8 @@
</span><span class="cx">                 E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E43A023D17EB3713004CDD25 /* RenderElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43A023C17EB3713004CDD25 /* RenderElement.cpp */; };
</span><ins>+                E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43AF8E41AC5B7DD00CA717E /* CacheValidation.cpp */; };
+                E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E43AF8E51AC5B7DD00CA717E /* CacheValidation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E44613A10CD6331000FADA75 /* HTMLAudioElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */; };
</span><span class="cx">                 E44613A20CD6331000FADA75 /* HTMLAudioElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613900CD6331000FADA75 /* HTMLAudioElement.h */; };
</span><span class="cx">                 E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */; };
</span><span class="lines">@@ -6254,8 +6256,6 @@
</span><span class="cx">                 E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
</span><span class="cx">                 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
</span><span class="cx">                 E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E467680E1A0177EE00B9E26B /* CacheValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E467680D1A0177EE00B9E26B /* CacheValidation.cpp */; };
-                E46768101A0177F900B9E26B /* CacheValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E467680F1A0177F900B9E26B /* CacheValidation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; };
</span><span class="lines">@@ -13808,6 +13808,8 @@
</span><span class="cx">                 E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
</span><span class="cx">                 E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 E43A023C17EB3713004CDD25 /* RenderElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderElement.cpp; sourceTree = "<group>"; };
</span><ins>+                E43AF8E41AC5B7DD00CA717E /* CacheValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheValidation.cpp; sourceTree = "<group>"; };
+                E43AF8E51AC5B7DD00CA717E /* CacheValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheValidation.h; sourceTree = "<group>"; };
</ins><span class="cx">                 E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLAudioElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E44613900CD6331000FADA75 /* HTMLAudioElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLAudioElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 E44613910CD6331000FADA75 /* HTMLAudioElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLAudioElement.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -13848,8 +13850,6 @@
</span><span class="cx">                 E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WidgetIOS.mm; path = ios/WidgetIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemMemoryIOS.cpp; path = ios/SystemMemoryIOS.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E462A4A0113E71BE004A4220 /* IntPointHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntPointHash.h; sourceTree = "<group>"; };
</span><del>-                E467680D1A0177EE00B9E26B /* CacheValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CacheValidation.cpp; path = loader/cache/CacheValidation.cpp; sourceTree = SOURCE_ROOT; };
-                E467680F1A0177F900B9E26B /* CacheValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CacheValidation.h; path = loader/cache/CacheValidation.h; sourceTree = SOURCE_ROOT; };
</del><span class="cx">                 E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; };
</span><span class="cx">                 E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; };
</span><span class="cx">                 E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -16573,6 +16573,8 @@
</span><span class="cx">                                 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */,
</span><span class="cx">                                 2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */,
</span><span class="cx">                                 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */,
</span><ins>+                                E43AF8E41AC5B7DD00CA717E /* CacheValidation.cpp */,
+                                E43AF8E51AC5B7DD00CA717E /* CacheValidation.h */,
</ins><span class="cx">                                 E13F01EA1270E10D00DFBA71 /* CookieStorage.h */,
</span><span class="cx">                                 514C76590CE923A1007EF3CD /* Credential.h */,
</span><span class="cx">                                 514C76580CE923A1007EF3CD /* CredentialBase.cpp */,
</span><span class="lines">@@ -19833,8 +19835,6 @@
</span><span class="cx">                                 BCB16C0E0979C3BD00467741 /* CachedXSLStyleSheet.cpp */,
</span><span class="cx">                                 BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */,
</span><span class="cx">                                 F587864902DE3A9A01EA4122 /* CachePolicy.h */,
</span><del>-                                E467680D1A0177EE00B9E26B /* CacheValidation.cpp */,
-                                E467680F1A0177F900B9E26B /* CacheValidation.h */,
</del><span class="cx">                                 BCB16BFE0979C3BD00467741 /* MemoryCache.cpp */,
</span><span class="cx">                                 BCB16BFF0979C3BD00467741 /* MemoryCache.h */,
</span><span class="cx">                                 1C0939E81A13E12900B788E5 /* CachedSVGFont.cpp */,
</span><span class="lines">@@ -23807,7 +23807,6 @@
</span><span class="cx">                                 0753860314489E9800B78452 /* CachedTextTrack.h in Headers */,
</span><span class="cx">                                 BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */,
</span><span class="cx">                                 93F1995008245E59001E9ABC /* CachePolicy.h in Headers */,
</span><del>-                                E46768101A0177F900B9E26B /* CacheValidation.h in Headers */,
</del><span class="cx">                                 49AE2D97134EE5F90072920A /* CalculationValue.h in Headers */,
</span><span class="cx">                                 B1D5ECB5134B58DA0087C78F /* CallbackFunction.h in Headers */,
</span><span class="cx">                                 6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
</span><span class="lines">@@ -25331,6 +25330,7 @@
</span><span class="cx">                                 AA7FEEA716A4E6F3004C0C33 /* JSSpeechSynthesisUtterance.h in Headers */,
</span><span class="cx">                                 AA7FEEA916A4E6F3004C0C33 /* JSSpeechSynthesisVoice.h in Headers */,
</span><span class="cx">                                 BC8243290D0CE8A200460C8F /* JSSQLError.h in Headers */,
</span><ins>+                                E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */,
</ins><span class="cx">                                 B525A96511CA2340003A23A8 /* JSSQLException.h in Headers */,
</span><span class="cx">                                 1AE82FED0CAB07EE002237AE /* JSSQLResultSet.h in Headers */,
</span><span class="cx">                                 1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */,
</span><span class="lines">@@ -27549,7 +27549,6 @@
</span><span class="cx">                                 E1B533471717D0A100F205F9 /* CachedSVGDocumentReference.cpp in Sources */,
</span><span class="cx">                                 0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */,
</span><span class="cx">                                 BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */,
</span><del>-                                E467680E1A0177EE00B9E26B /* CacheValidation.cpp in Sources */,
</del><span class="cx">                                 49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
</span><span class="cx">                                 B1827493134CA4C100B98C2D /* CallbackFunction.cpp in Sources */,
</span><span class="cx">                                 6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
</span><span class="lines">@@ -29537,6 +29536,7 @@
</span><span class="cx">                                 A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */,
</span><span class="cx">                                 1A3586DF15264C450022A659 /* RenderMultiColumnFlowThread.cpp in Sources */,
</span><span class="cx">                                 BCE32B9E1517C22700F542EC /* RenderMultiColumnSet.cpp in Sources */,
</span><ins>+                                E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */,
</ins><span class="cx">                                 BC1A7D9718FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp in Sources */,
</span><span class="cx">                                 8AC822FC180FC03300FB64D5 /* RenderNamedFlowFragment.cpp in Sources */,
</span><span class="cx">                                 1A3FF9C315265359002288A1 /* RenderNamedFlowThread.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCacheValidationcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/loader/cache/CacheValidation.cpp (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CacheValidation.cpp        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/loader/cache/CacheValidation.cpp        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -1,293 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CacheValidation.h"
-
-#include "HTTPHeaderMap.h"
-#include "ResourceResponse.h"
-#include <wtf/CurrentTime.h>
-
-namespace WebCore {
-
-// These response headers are not copied from a revalidated response to the
-// cached response headers. For compatibility, this list is based on Chromium's
-// net/http/http_response_headers.cc.
-const char* const headersToIgnoreAfterRevalidation[] = {
- "allow",
- "connection",
- "etag",
- "expires",
- "keep-alive",
- "last-modified"
- "proxy-authenticate",
- "proxy-connection",
- "trailer",
- "transfer-encoding",
- "upgrade",
- "www-authenticate",
- "x-frame-options",
- "x-xss-protection",
-};
-
-// Some header prefixes mean "Don't copy this header from a 304 response.".
-// Rather than listing all the relevant headers, we can consolidate them into
-// this list, also grabbed from Chromium's net/http/http_response_headers.cc.
-const char* const headerPrefixesToIgnoreAfterRevalidation[] = {
- "content-",
- "x-content-",
- "x-webkit-"
-};
-
-static inline bool shouldUpdateHeaderAfterRevalidation(const String& header)
-{
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(headersToIgnoreAfterRevalidation); i++) {
- if (equalIgnoringCase(header, headersToIgnoreAfterRevalidation[i]))
- return false;
- }
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(headerPrefixesToIgnoreAfterRevalidation); i++) {
- if (header.startsWith(headerPrefixesToIgnoreAfterRevalidation[i], false))
- return false;
- }
- return true;
-}
-
-void updateResponseHeadersAfterRevalidation(ResourceResponse& response, const ResourceResponse& validatingResponse)
-{
- // RFC2616 10.3.5
- // Update cached headers from the 304 response
- for (const auto& header : validatingResponse.httpHeaderFields()) {
- // Entity headers should not be sent by servers when generating a 304
- // response; misconfigured servers send them anyway. We shouldn't allow
- // such headers to update the original request. We'll base this on the
- // list defined by RFC2616 7.1, with a few additions for extension headers
- // we care about.
- if (!shouldUpdateHeaderAfterRevalidation(header.key))
- continue;
- response.setHTTPHeaderField(header.key, header.value);
- }
-}
-
-double computeCurrentAge(const ResourceResponse& response, double responseTimestamp)
-{
- // RFC2616 13.2.3
- // No compensation for latency as that is not terribly important in practice
- double dateValue = response.date();
- double apparentAge = std::isfinite(dateValue) ? std::max(0., responseTimestamp - dateValue) : 0;
- double ageValue = response.age();
- double correctedReceivedAge = std::isfinite(ageValue) ? std::max(apparentAge, ageValue) : apparentAge;
- double residentTime = currentTime() - responseTimestamp;
- return correctedReceivedAge + residentTime;
-}
-
-double computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, double responseTimestamp)
-{
- ASSERT(response.url().protocolIsInHTTPFamily());
- // RFC2616 13.2.4
- double maxAgeValue = response.cacheControlMaxAge();
- if (std::isfinite(maxAgeValue))
- return maxAgeValue;
- double expiresValue = response.expires();
- double dateValue = response.date();
- double creationTime = std::isfinite(dateValue) ? dateValue : responseTimestamp;
- if (std::isfinite(expiresValue))
- return expiresValue - creationTime;
- double lastModifiedValue = response.lastModified();
- if (std::isfinite(lastModifiedValue))
- return (creationTime - lastModifiedValue) * 0.1;
- // If no cache headers are present, the specification leaves the decision to the UA. Other browsers seem to opt for 0.
- return 0;
-}
-
-void updateRedirectChainStatus(RedirectChainCacheStatus& redirectChainCacheStatus, const ResourceResponse& response)
-{
- if (redirectChainCacheStatus.status == RedirectChainCacheStatus::NotCachedRedirection)
- return;
- if (response.cacheControlContainsNoStore() || response.cacheControlContainsNoCache() || response.cacheControlContainsMustRevalidate()) {
- redirectChainCacheStatus.status = RedirectChainCacheStatus::NotCachedRedirection;
- return;
- }
- redirectChainCacheStatus.status = RedirectChainCacheStatus::CachedRedirection;
- double responseTimestamp = currentTime();
- // Store the nearest end of cache validity date
- double endOfValidity = responseTimestamp + computeFreshnessLifetimeForHTTPFamily(response, responseTimestamp) - computeCurrentAge(response, responseTimestamp);
- redirectChainCacheStatus.endOfValidity = std::min(redirectChainCacheStatus.endOfValidity, endOfValidity);
-}
-
-bool redirectChainAllowsReuse(RedirectChainCacheStatus redirectChainCacheStatus, ReuseExpiredRedirectionOrNot reuseExpiredRedirection)
-{
- switch (redirectChainCacheStatus.status) {
- case RedirectChainCacheStatus::NoRedirection:
- return true;
- case RedirectChainCacheStatus::NotCachedRedirection:
- return false;
- case RedirectChainCacheStatus::CachedRedirection:
- return reuseExpiredRedirection || currentTime() <= redirectChainCacheStatus.endOfValidity;
- }
- ASSERT_NOT_REACHED();
- return false;
-}
-
-inline bool isCacheHeaderSeparator(UChar c)
-{
- // See RFC 2616, Section 2.2
- switch (c) {
- case '(':
- case ')':
- case '<':
- case '>':
- case '@':
- case ',':
- case ';':
- case ':':
- case '\\':
- case '"':
- case '/':
- case '[':
- case ']':
- case '?':
- case '=':
- case '{':
- case '}':
- case ' ':
- case '\t':
- return true;
- default:
- return false;
- }
-}
-
-inline bool isControlCharacter(UChar c)
-{
- return c < ' ' || c == 127;
-}
-
-inline String trimToNextSeparator(const String& str)
-{
- return str.substring(0, str.find(isCacheHeaderSeparator));
-}
-
-static Vector<std::pair<String, String>> parseCacheHeader(const String& header)
-{
- Vector<std::pair<String, String>> result;
-
- const String safeHeader = header.removeCharacters(isControlCharacter);
- unsigned max = safeHeader.length();
- unsigned pos = 0;
- while (pos < max) {
- size_t nextCommaPosition = safeHeader.find(',', pos);
- size_t nextEqualSignPosition = safeHeader.find('=', pos);
- if (nextEqualSignPosition == notFound && nextCommaPosition == notFound) {
- // Add last directive to map with empty string as value
- result.append(std::make_pair(trimToNextSeparator(safeHeader.substring(pos, max - pos).stripWhiteSpace()), ""));
- return result;
- }
- if (nextCommaPosition != notFound && (nextCommaPosition < nextEqualSignPosition || nextEqualSignPosition == notFound)) {
- // Add directive to map with empty string as value
- result.append(std::make_pair(trimToNextSeparator(safeHeader.substring(pos, nextCommaPosition - pos).stripWhiteSpace()), ""));
- pos += nextCommaPosition - pos + 1;
- continue;
- }
- // Get directive name, parse right hand side of equal sign, then add to map
- String directive = trimToNextSeparator(safeHeader.substring(pos, nextEqualSignPosition - pos).stripWhiteSpace());
- pos += nextEqualSignPosition - pos + 1;
-
- String value = safeHeader.substring(pos, max - pos).stripWhiteSpace();
- if (value[0] == '"') {
- // The value is a quoted string
- size_t nextDoubleQuotePosition = value.find('"', 1);
- if (nextDoubleQuotePosition == notFound) {
- // Parse error; just use the rest as the value
- result.append(std::make_pair(directive, trimToNextSeparator(value.substring(1, value.length() - 1).stripWhiteSpace())));
- return result;
- }
- // Store the value as a quoted string without quotes
- result.append(std::make_pair(directive, value.substring(1, nextDoubleQuotePosition - 1).stripWhiteSpace()));
- pos += (safeHeader.find('"', pos) - pos) + nextDoubleQuotePosition + 1;
- // Move past next comma, if there is one
- size_t nextCommaPosition2 = safeHeader.find(',', pos);
- if (nextCommaPosition2 == notFound)
- return result; // Parse error if there is anything left with no comma
- pos += nextCommaPosition2 - pos + 1;
- continue;
- }
- // The value is a token until the next comma
- size_t nextCommaPosition2 = value.find(',');
- if (nextCommaPosition2 == notFound) {
- // The rest is the value; no change to value needed
- result.append(std::make_pair(directive, trimToNextSeparator(value)));
- return result;
- }
- // The value is delimited by the next comma
- result.append(std::make_pair(directive, trimToNextSeparator(value.substring(0, nextCommaPosition2).stripWhiteSpace())));
- pos += (safeHeader.find(',', pos) - pos) + 1;
- }
- return result;
-}
-
-CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
-{
- CacheControlDirectives result;
-
- String cacheControlValue = headers.get(HTTPHeaderName::CacheControl);
- if (!cacheControlValue.isEmpty()) {
- auto directives = parseCacheHeader(cacheControlValue);
-
- size_t directivesSize = directives.size();
- for (size_t i = 0; i < directivesSize; ++i) {
- // RFC2616 14.9.1: A no-cache directive with a value is only meaningful for proxy caches.
- // It should be ignored by a browser level cache.
- if (equalIgnoringCase(directives[i].first, "no-cache") && directives[i].second.isEmpty())
- result.noCache = true;
- else if (equalIgnoringCase(directives[i].first, "no-store"))
- result.noStore = true;
- else if (equalIgnoringCase(directives[i].first, "must-revalidate"))
- result.mustRevalidate = true;
- else if (equalIgnoringCase(directives[i].first, "max-age")) {
- if (!std::isnan(result.maxAge)) {
- // First max-age directive wins if there are multiple ones.
- continue;
- }
- bool ok;
- double maxAge = directives[i].second.toDouble(&ok);
- if (ok)
- result.maxAge = maxAge;
- }
- }
- }
-
- if (!result.noCache) {
- // Handle Pragma: no-cache
- // This is deprecated and equivalent to Cache-control: no-cache
- // Don't bother tokenizing the value, it is not important
- String pragmaValue = headers.get(HTTPHeaderName::Pragma);
-
- result.noCache = pragmaValue.contains("no-cache", false);
- }
-
- return result;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCacheValidationh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/loader/cache/CacheValidation.h (182063 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CacheValidation.h        2015-03-27 16:42:16 UTC (rev 182063)
+++ trunk/Source/WebCore/loader/cache/CacheValidation.h        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -1,66 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CacheValidation_h
-#define CacheValidation_h
-
-namespace WebCore {
-
-class HTTPHeaderMap;
-class ResourceResponse;
-
-struct RedirectChainCacheStatus {
- enum Status {
- NoRedirection,
- NotCachedRedirection,
- CachedRedirection
- };
- RedirectChainCacheStatus()
- : status(NoRedirection)
- , endOfValidity(std::numeric_limits<double>::max())
- { }
- Status status;
- double endOfValidity;
-};
-
-WEBCORE_EXPORT double computeCurrentAge(const ResourceResponse&, double responseTimestamp);
-WEBCORE_EXPORT double computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, double responseTimestamp);
-WEBCORE_EXPORT void updateResponseHeadersAfterRevalidation(ResourceResponse&, const ResourceResponse& validatingResponse);
-WEBCORE_EXPORT void updateRedirectChainStatus(RedirectChainCacheStatus&, const ResourceResponse&);
-
-enum ReuseExpiredRedirectionOrNot { DoNotReuseExpiredRedirection, ReuseExpiredRedirection };
-WEBCORE_EXPORT bool redirectChainAllowsReuse(RedirectChainCacheStatus, ReuseExpiredRedirectionOrNot);
-
-struct CacheControlDirectives {
- double maxAge { std::numeric_limits<double>::quiet_NaN() };
- bool noCache { false };
- bool noStore { false };
- bool mustRevalidate { false };
-};
-WEBCORE_EXPORT CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap&);
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkCacheValidationcppfromrev182059trunkSourceWebCoreloadercacheCacheValidationcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/network/CacheValidation.cpp (from rev 182059, trunk/Source/WebCore/loader/cache/CacheValidation.cpp) (0 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/CacheValidation.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/network/CacheValidation.cpp        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -0,0 +1,293 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CacheValidation.h"
+
+#include "HTTPHeaderMap.h"
+#include "ResourceResponse.h"
+#include <wtf/CurrentTime.h>
+
+namespace WebCore {
+
+// These response headers are not copied from a revalidated response to the
+// cached response headers. For compatibility, this list is based on Chromium's
+// net/http/http_response_headers.cc.
+const char* const headersToIgnoreAfterRevalidation[] = {
+ "allow",
+ "connection",
+ "etag",
+ "expires",
+ "keep-alive",
+ "last-modified"
+ "proxy-authenticate",
+ "proxy-connection",
+ "trailer",
+ "transfer-encoding",
+ "upgrade",
+ "www-authenticate",
+ "x-frame-options",
+ "x-xss-protection",
+};
+
+// Some header prefixes mean "Don't copy this header from a 304 response.".
+// Rather than listing all the relevant headers, we can consolidate them into
+// this list, also grabbed from Chromium's net/http/http_response_headers.cc.
+const char* const headerPrefixesToIgnoreAfterRevalidation[] = {
+ "content-",
+ "x-content-",
+ "x-webkit-"
+};
+
+static inline bool shouldUpdateHeaderAfterRevalidation(const String& header)
+{
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(headersToIgnoreAfterRevalidation); i++) {
+ if (equalIgnoringCase(header, headersToIgnoreAfterRevalidation[i]))
+ return false;
+ }
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(headerPrefixesToIgnoreAfterRevalidation); i++) {
+ if (header.startsWith(headerPrefixesToIgnoreAfterRevalidation[i], false))
+ return false;
+ }
+ return true;
+}
+
+void updateResponseHeadersAfterRevalidation(ResourceResponse& response, const ResourceResponse& validatingResponse)
+{
+ // RFC2616 10.3.5
+ // Update cached headers from the 304 response
+ for (const auto& header : validatingResponse.httpHeaderFields()) {
+ // Entity headers should not be sent by servers when generating a 304
+ // response; misconfigured servers send them anyway. We shouldn't allow
+ // such headers to update the original request. We'll base this on the
+ // list defined by RFC2616 7.1, with a few additions for extension headers
+ // we care about.
+ if (!shouldUpdateHeaderAfterRevalidation(header.key))
+ continue;
+ response.setHTTPHeaderField(header.key, header.value);
+ }
+}
+
+double computeCurrentAge(const ResourceResponse& response, double responseTimestamp)
+{
+ // RFC2616 13.2.3
+ // No compensation for latency as that is not terribly important in practice
+ double dateValue = response.date();
+ double apparentAge = std::isfinite(dateValue) ? std::max(0., responseTimestamp - dateValue) : 0;
+ double ageValue = response.age();
+ double correctedReceivedAge = std::isfinite(ageValue) ? std::max(apparentAge, ageValue) : apparentAge;
+ double residentTime = currentTime() - responseTimestamp;
+ return correctedReceivedAge + residentTime;
+}
+
+double computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, double responseTimestamp)
+{
+ ASSERT(response.url().protocolIsInHTTPFamily());
+ // RFC2616 13.2.4
+ double maxAgeValue = response.cacheControlMaxAge();
+ if (std::isfinite(maxAgeValue))
+ return maxAgeValue;
+ double expiresValue = response.expires();
+ double dateValue = response.date();
+ double creationTime = std::isfinite(dateValue) ? dateValue : responseTimestamp;
+ if (std::isfinite(expiresValue))
+ return expiresValue - creationTime;
+ double lastModifiedValue = response.lastModified();
+ if (std::isfinite(lastModifiedValue))
+ return (creationTime - lastModifiedValue) * 0.1;
+ // If no cache headers are present, the specification leaves the decision to the UA. Other browsers seem to opt for 0.
+ return 0;
+}
+
+void updateRedirectChainStatus(RedirectChainCacheStatus& redirectChainCacheStatus, const ResourceResponse& response)
+{
+ if (redirectChainCacheStatus.status == RedirectChainCacheStatus::NotCachedRedirection)
+ return;
+ if (response.cacheControlContainsNoStore() || response.cacheControlContainsNoCache() || response.cacheControlContainsMustRevalidate()) {
+ redirectChainCacheStatus.status = RedirectChainCacheStatus::NotCachedRedirection;
+ return;
+ }
+ redirectChainCacheStatus.status = RedirectChainCacheStatus::CachedRedirection;
+ double responseTimestamp = currentTime();
+ // Store the nearest end of cache validity date
+ double endOfValidity = responseTimestamp + computeFreshnessLifetimeForHTTPFamily(response, responseTimestamp) - computeCurrentAge(response, responseTimestamp);
+ redirectChainCacheStatus.endOfValidity = std::min(redirectChainCacheStatus.endOfValidity, endOfValidity);
+}
+
+bool redirectChainAllowsReuse(RedirectChainCacheStatus redirectChainCacheStatus, ReuseExpiredRedirectionOrNot reuseExpiredRedirection)
+{
+ switch (redirectChainCacheStatus.status) {
+ case RedirectChainCacheStatus::NoRedirection:
+ return true;
+ case RedirectChainCacheStatus::NotCachedRedirection:
+ return false;
+ case RedirectChainCacheStatus::CachedRedirection:
+ return reuseExpiredRedirection || currentTime() <= redirectChainCacheStatus.endOfValidity;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+inline bool isCacheHeaderSeparator(UChar c)
+{
+ // See RFC 2616, Section 2.2
+ switch (c) {
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case '@':
+ case ',':
+ case ';':
+ case ':':
+ case '\\':
+ case '"':
+ case '/':
+ case '[':
+ case ']':
+ case '?':
+ case '=':
+ case '{':
+ case '}':
+ case ' ':
+ case '\t':
+ return true;
+ default:
+ return false;
+ }
+}
+
+inline bool isControlCharacter(UChar c)
+{
+ return c < ' ' || c == 127;
+}
+
+inline String trimToNextSeparator(const String& str)
+{
+ return str.substring(0, str.find(isCacheHeaderSeparator));
+}
+
+static Vector<std::pair<String, String>> parseCacheHeader(const String& header)
+{
+ Vector<std::pair<String, String>> result;
+
+ const String safeHeader = header.removeCharacters(isControlCharacter);
+ unsigned max = safeHeader.length();
+ unsigned pos = 0;
+ while (pos < max) {
+ size_t nextCommaPosition = safeHeader.find(',', pos);
+ size_t nextEqualSignPosition = safeHeader.find('=', pos);
+ if (nextEqualSignPosition == notFound && nextCommaPosition == notFound) {
+ // Add last directive to map with empty string as value
+ result.append(std::make_pair(trimToNextSeparator(safeHeader.substring(pos, max - pos).stripWhiteSpace()), ""));
+ return result;
+ }
+ if (nextCommaPosition != notFound && (nextCommaPosition < nextEqualSignPosition || nextEqualSignPosition == notFound)) {
+ // Add directive to map with empty string as value
+ result.append(std::make_pair(trimToNextSeparator(safeHeader.substring(pos, nextCommaPosition - pos).stripWhiteSpace()), ""));
+ pos += nextCommaPosition - pos + 1;
+ continue;
+ }
+ // Get directive name, parse right hand side of equal sign, then add to map
+ String directive = trimToNextSeparator(safeHeader.substring(pos, nextEqualSignPosition - pos).stripWhiteSpace());
+ pos += nextEqualSignPosition - pos + 1;
+
+ String value = safeHeader.substring(pos, max - pos).stripWhiteSpace();
+ if (value[0] == '"') {
+ // The value is a quoted string
+ size_t nextDoubleQuotePosition = value.find('"', 1);
+ if (nextDoubleQuotePosition == notFound) {
+ // Parse error; just use the rest as the value
+ result.append(std::make_pair(directive, trimToNextSeparator(value.substring(1, value.length() - 1).stripWhiteSpace())));
+ return result;
+ }
+ // Store the value as a quoted string without quotes
+ result.append(std::make_pair(directive, value.substring(1, nextDoubleQuotePosition - 1).stripWhiteSpace()));
+ pos += (safeHeader.find('"', pos) - pos) + nextDoubleQuotePosition + 1;
+ // Move past next comma, if there is one
+ size_t nextCommaPosition2 = safeHeader.find(',', pos);
+ if (nextCommaPosition2 == notFound)
+ return result; // Parse error if there is anything left with no comma
+ pos += nextCommaPosition2 - pos + 1;
+ continue;
+ }
+ // The value is a token until the next comma
+ size_t nextCommaPosition2 = value.find(',');
+ if (nextCommaPosition2 == notFound) {
+ // The rest is the value; no change to value needed
+ result.append(std::make_pair(directive, trimToNextSeparator(value)));
+ return result;
+ }
+ // The value is delimited by the next comma
+ result.append(std::make_pair(directive, trimToNextSeparator(value.substring(0, nextCommaPosition2).stripWhiteSpace())));
+ pos += (safeHeader.find(',', pos) - pos) + 1;
+ }
+ return result;
+}
+
+CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
+{
+ CacheControlDirectives result;
+
+ String cacheControlValue = headers.get(HTTPHeaderName::CacheControl);
+ if (!cacheControlValue.isEmpty()) {
+ auto directives = parseCacheHeader(cacheControlValue);
+
+ size_t directivesSize = directives.size();
+ for (size_t i = 0; i < directivesSize; ++i) {
+ // RFC2616 14.9.1: A no-cache directive with a value is only meaningful for proxy caches.
+ // It should be ignored by a browser level cache.
+ if (equalIgnoringCase(directives[i].first, "no-cache") && directives[i].second.isEmpty())
+ result.noCache = true;
+ else if (equalIgnoringCase(directives[i].first, "no-store"))
+ result.noStore = true;
+ else if (equalIgnoringCase(directives[i].first, "must-revalidate"))
+ result.mustRevalidate = true;
+ else if (equalIgnoringCase(directives[i].first, "max-age")) {
+ if (!std::isnan(result.maxAge)) {
+ // First max-age directive wins if there are multiple ones.
+ continue;
+ }
+ bool ok;
+ double maxAge = directives[i].second.toDouble(&ok);
+ if (ok)
+ result.maxAge = maxAge;
+ }
+ }
+ }
+
+ if (!result.noCache) {
+ // Handle Pragma: no-cache
+ // This is deprecated and equivalent to Cache-control: no-cache
+ // Don't bother tokenizing the value, it is not important
+ String pragmaValue = headers.get(HTTPHeaderName::Pragma);
+
+ result.noCache = pragmaValue.contains("no-cache", false);
+ }
+
+ return result;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkCacheValidationhfromrev182059trunkSourceWebCoreloadercacheCacheValidationh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/network/CacheValidation.h (from rev 182059, trunk/Source/WebCore/loader/cache/CacheValidation.h) (0 => 182064)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/CacheValidation.h         (rev 0)
+++ trunk/Source/WebCore/platform/network/CacheValidation.h        2015-03-27 16:49:21 UTC (rev 182064)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CacheValidation_h
+#define CacheValidation_h
+
+namespace WebCore {
+
+class HTTPHeaderMap;
+class ResourceResponse;
+
+struct RedirectChainCacheStatus {
+ enum Status {
+ NoRedirection,
+ NotCachedRedirection,
+ CachedRedirection
+ };
+ RedirectChainCacheStatus()
+ : status(NoRedirection)
+ , endOfValidity(std::numeric_limits<double>::max())
+ { }
+ Status status;
+ double endOfValidity;
+};
+
+WEBCORE_EXPORT double computeCurrentAge(const ResourceResponse&, double responseTimestamp);
+WEBCORE_EXPORT double computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, double responseTimestamp);
+WEBCORE_EXPORT void updateResponseHeadersAfterRevalidation(ResourceResponse&, const ResourceResponse& validatingResponse);
+WEBCORE_EXPORT void updateRedirectChainStatus(RedirectChainCacheStatus&, const ResourceResponse&);
+
+enum ReuseExpiredRedirectionOrNot { DoNotReuseExpiredRedirection, ReuseExpiredRedirection };
+WEBCORE_EXPORT bool redirectChainAllowsReuse(RedirectChainCacheStatus, ReuseExpiredRedirectionOrNot);
+
+struct CacheControlDirectives {
+ double maxAge { std::numeric_limits<double>::quiet_NaN() };
+ bool noCache { false };
+ bool noStore { false };
+ bool mustRevalidate { false };
+};
+WEBCORE_EXPORT CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap&);
+
+}
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>