<!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>[207330] trunk</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/207330">207330</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-14 01:47:16 -0700 (Fri, 14 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make NetworkCache aware of fetch cache mode
https://bugs.webkit.org/show_bug.cgi?id=163332
Patch by Youenn Fablet <youenn@apple.com> on 2016-10-14
Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:
Splitting web-platform-tests/fetch/api/request/request-cache.html in several files so that running the individual test files
is more manageable.
* web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-default-conditional.html: Added.
* web-platform-tests/fetch/api/request/request-cache-default-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-default.html: Added.
* web-platform-tests/fetch/api/request/request-cache-expected.txt: Removed.
* web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-force-cache.html: Added.
* web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-no-cache.html: Added.
* web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-no-store.html: Added.
* web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-only-if-cached.html: Added.
* web-platform-tests/fetch/api/request/request-cache-reload-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache-reload.html: Added.
* web-platform-tests/fetch/api/request/request-cache.html: Removed.
* web-platform-tests/fetch/api/request/request-cache.js: Added.
(base_path):
(make_url):
(expected_status):
(expected_response_text):
(server_state):
(run_next_step):
(make_test):
Source/WebCore:
Tests: imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html
imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html
* loader/cache/CachedResourceLoader.cpp:
(WebCore::updateRequestAccordingCacheMode): Setting request cache policy according cache mode.
Basically, these two are about the same.
(WebCore::CachedResourceLoader::determineRevalidationPolicy): Making use of cache policy instead of cache mode.
* platform/network/ResourceRequestBase.h: Adding new cache policies, aligned with fetch cache modes.
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::toPlatformRequestCachePolicy): If policy is not supported by CFNetwork, fallback to ReloadIgnoringCacheData.
This is the best approximate we might find.
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::doUpdateResourceRequest): Only updating cache policy, if cache policy is the default.
* platform/network/cf/ResourceRequestCFNet.h:
* platform/network/cocoa/ResourceRequestCocoa.mm: Doing the same modifications as for ResourceRequestCFNet.
(WebCore::ResourceRequest::doUpdateResourceRequest):
(WebCore::toPlatformRequestCachePolicy):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
Source/WebKit2:
Adding explicit serialization of ResourceRequest cachePolicy since it does no longer map to platform request cache policy.
Added support for:
- Bypassing entirely the network cache in case cache mode is NoStore.
- requiring revalidation in case of cache hit and cache mode is NoCache.
- Not using any entry if cache mode is Reload (but cache can still be updated)
Also made sure that the ResourceRequest::cachePolicy remains the same throughout redirections.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::canUseCache):
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::cachePolicyAllowsExpired):
(WebKit::NetworkCache::makeRetrieveDecision):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
(IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
LayoutTests:
* platform/ios-simulator/TestExpectations:
* platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt: Added.
* platform/win/TestExpectations:
* platform/wk2/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceRequestcpp">trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceRequestBaseh">trunk/Source/WebCore/platform/network/ResourceRequestBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceRequestCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceRequestCFNeth">trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcocoaResourceRequestCocoamm">trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm">trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultconditionalexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultconditionalhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaulthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheforcecacheexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheforcecachehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenocacheexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenocachehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenostoreexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenostorehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachereloadexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachereloadhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachejs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js</a></li>
<li>trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/</li>
<li>trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/</li>
<li>trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/</li>
<li><a href="#trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedexpectedtxt">trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsfetchapirequestrequestcachereloadexpectedtxt">trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/ChangeLog        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-14 Youenn Fablet <youenn@apple.com>
+
+ Make NetworkCache aware of fetch cache mode
+ https://bugs.webkit.org/show_bug.cgi?id=163332
+
+ Reviewed by Antti Koivisto.
+
+ * platform/ios-simulator/TestExpectations:
+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt: Added.
+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt: Added.
+ * platform/win/TestExpectations:
+ * platform/wk2/TestExpectations:
+
</ins><span class="cx"> 2016-10-13 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Exception message for expressions with multiple bracket accesses is inconsistent / incorrect
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-10-14 Youenn Fablet <youenn@apple.com>
+
+ Make NetworkCache aware of fetch cache mode
+ https://bugs.webkit.org/show_bug.cgi?id=163332
+
+ Reviewed by Antti Koivisto.
+
+ Splitting web-platform-tests/fetch/api/request/request-cache.html in several files so that running the individual test files
+ is more manageable.
+
+ * web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-default-conditional.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-default-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-default.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-expected.txt: Removed.
+ * web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-force-cache.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-no-cache.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-no-store.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-only-if-cached.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache-reload-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-cache-reload.html: Added.
+ * web-platform-tests/fetch/api/request/request-cache.html: Removed.
+ * web-platform-tests/fetch/api/request/request-cache.js: Added.
+ (base_path):
+ (make_url):
+ (expected_status):
+ (expected_response_text):
+ (server_state):
+ (run_next_step):
+ (make_test):
+
</ins><span class="cx"> 2016-10-13 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Exception message for expressions with multiple bracket accesses is inconsistent / incorrect
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultconditionalexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and fresh response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and stale response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and stale response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and fresh response
+PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultconditionalhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,180 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - default with conditional requests</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-None-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-None-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-None-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-None-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Range": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Range": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Range": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Range": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaultexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses with Etag and stale response
+PASS RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses with date and stale response
+PASS RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with Etag and fresh response
+PASS RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with date and fresh response
+PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with Etag and stale response
+PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with date and stale response
+PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with Etag and fresh response
+PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachedefaulthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - default</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses',
+ state: "stale",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+ state: "stale",
+ cache_control: "no-store",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+ state: "fresh",
+ cache_control: "no-store",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,104 +0,0 @@
</span><del>-
-PASS RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses with Etag and stale response
-PASS RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses with date and stale response
-PASS RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with Etag and fresh response
-PASS RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with date and fresh response
-PASS RequestCache "no-cache" mode revalidates stale responses found in the cache with Etag and stale response
-PASS RequestCache "no-cache" mode revalidates stale responses found in the cache with date and stale response
-PASS RequestCache "no-cache" mode revalidates fresh responses found in the cache with Etag and fresh response
-PASS RequestCache "no-cache" mode revalidates fresh responses found in the cache with date and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with Etag and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with date and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with Etag and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with date and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with Etag and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with date and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with Etag and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with date and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with Etag and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with date and stale response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with Etag and fresh response
-PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with date and fresh response
-PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with Etag and stale response
-PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with date and stale response
-PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with Etag and fresh response
-PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with date and fresh response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Etag and stale response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with date and stale response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with Etag and fresh response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with date and fresh response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Etag and fresh response
-PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with date and fresh response
-FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"
-PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and fresh response
-PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and fresh response
-PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and stale response
-PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and stale response
-PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with Etag and stale response
-PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with date and stale response
-PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with Etag and fresh response
-PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with date and fresh response
-PASS RequestCache "no-store" mode does not store the response in the cache with Etag and stale response
-PASS RequestCache "no-store" mode does not store the response in the cache with date and stale response
-PASS RequestCache "no-store" mode does not store the response in the cache with Etag and fresh response
-PASS RequestCache "no-store" mode does not store the response in the cache with date and fresh response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Match header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and fresh response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and stale response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and stale response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with Etag and fresh response
-PASS RequestCache "default" mode with an If-Range header is treated similarly to "no-store" with date and fresh response
-PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with Etag and stale response
-PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with date and stale response
-PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with Etag and fresh response
-PASS Responses with the "Cache-Control: no-store" header are not stored in the cache with date and fresh response
-PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and stale response
-PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and stale response
-PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and fresh response
-PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and fresh response
-PASS RequestCache "reload" mode does store the response in the cache with Etag and stale response
-PASS RequestCache "reload" mode does store the response in the cache with date and stale response
-FAIL RequestCache "reload" mode does store the response in the cache with Etag and fresh response assert_equals: expected 1 but got 2
-FAIL RequestCache "reload" mode does store the response in the cache with date and fresh response assert_equals: expected 1 but got 2
-PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and stale response
-PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and stale response
-PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and fresh response
-PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and fresh response
-
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheforcecacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with Etag and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with date and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with Etag and fresh response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with date and fresh response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with Etag and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with date and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with Etag and fresh response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found with date and fresh response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with Etag and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with date and stale response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with Etag and fresh response
+PASS RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary with date and fresh response
+PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with Etag and stale response
+PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with date and stale response
+PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with Etag and fresh response
+PASS RequestCache "force-cache" stores the response in the cache if it goes to the network with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheforcecachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - force-cache</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses',
+ state: "stale",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses',
+ state: "fresh",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+ state: "stale",
+ request_cache: ["force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+ state: "fresh",
+ request_cache: ["force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+ state: "stale",
+ vary: "*",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+ state: "fresh",
+ vary: "*",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+ state: "stale",
+ request_cache: ["force-cache", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+ state: "fresh",
+ request_cache: ["force-cache", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenocacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS RequestCache "no-cache" mode revalidates stale responses found in the cache with Etag and stale response
+PASS RequestCache "no-cache" mode revalidates stale responses found in the cache with date and stale response
+PASS RequestCache "no-cache" mode revalidates fresh responses found in the cache with Etag and fresh response
+PASS RequestCache "no-cache" mode revalidates fresh responses found in the cache with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenocachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache : no-cache</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "no-cache" mode revalidates stale responses found in the cache',
+ state: "stale",
+ request_cache: ["default", "no-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ expected_max_age_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-cache" mode revalidates fresh responses found in the cache',
+ state: "fresh",
+ request_cache: ["default", "no-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ expected_max_age_headers: [false, true],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenostoreexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with Etag and stale response
+PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with date and stale response
+PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with Etag and fresh response
+PASS RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless with date and fresh response
+PASS RequestCache "no-store" mode does not store the response in the cache with Etag and stale response
+PASS RequestCache "no-store" mode does not store the response in the cache with date and stale response
+PASS RequestCache "no-store" mode does not store the response in the cache with Etag and fresh response
+PASS RequestCache "no-store" mode does not store the response in the cache with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachenostorehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - no store</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "stale",
+ request_cache: ["default", "no-store"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "fresh",
+ request_cache: ["default", "no-store"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not store the response in the cache',
+ state: "stale",
+ request_cache: ["no-store", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not store the response in the cache',
+ state: "fresh",
+ request_cache: ["no-store", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=2ea4f431-f8b9-4e0e-b2ab-5c8c14d9fddd&content=0.38709557547171725&tag=0.479555361588907&expires=Tue,%2003%20Oct%202017%2022:00:00%20GMT from frame with URL http://localhost:8800/fetch/api/request/request-cache-only-if-cached.html. Domains, protocols and ports must match.
+
+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=d8c7da3d-d121-44ce-9de7-cfee3b6a3737&content=0.797971561144814&date=Thu,%2013%20Oct%202016%2009:15:42%20GMT&expires=Tue,%2003%20Oct%202017%2022:00:00%20GMT from frame with URL http://localhost:8800/fetch/api/request/request-cache-only-if-cached.html. Domains, protocols and ports must match.
+
+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=40ec0908-6ae7-44cf-b2ed-9eb5620a6f7c&content=0.4833112948629348&tag=0.9322512369284536&expires=Sat,%2003%20Oct%202015%2022:00:00%20GMT from frame with URL http://localhost:8800/fetch/api/request/request-cache-only-if-cached.html. Domains, protocols and ports must match.
+
+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=90f850f5-f936-4654-abdc-4568f11f59a3&content=0.030517910813487314&date=Thu,%2013%20Oct%202016%2009:15:42%20GMT&expires=Sat,%2003%20Oct%202015%2022:00:00%20GMT from frame with URL http://localhost:8800/fetch/api/request/request-cache-only-if-cached.html. Domains, protocols and ports must match.
+
+
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Etag and stale response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with date and stale response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with Etag and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with date and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Etag and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with date and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response
+PASS RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and stale response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and stale response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and stale response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - only-if-cached</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses',
+ state: "stale",
+ request_cache: ["default", "only-if-cached"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false]
+ },
+ {
+ name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses',
+ state: "fresh",
+ request_cache: ["default", "only-if-cached"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false]
+ },
+ {
+ name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found',
+ state: "fresh",
+ request_cache: ["only-if-cached"],
+ response: ["error"],
+ expected_validation_headers: [],
+ expected_no_cache_headers: []
+ },
+ {
+ name: 'RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content',
+ state: "fresh",
+ request_cache: ["default", "only-if-cached"],
+ redirect: "same-origin",
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content',
+ state: "stale",
+ request_cache: ["default", "only-if-cached"],
+ redirect: "same-origin",
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects',
+ state: "fresh",
+ request_cache: ["default", "only-if-cached"],
+ redirect: "cross-origin",
+ response: [null, "error"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects',
+ state: "stale",
+ request_cache: ["default", "only-if-cached"],
+ redirect: "cross-origin",
+ response: [null, "error"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachereloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and stale response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and stale response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and fresh response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and fresh response
+PASS RequestCache "reload" mode does store the response in the cache with Etag and stale response
+PASS RequestCache "reload" mode does store the response in the cache with date and stale response
+PASS RequestCache "reload" mode does store the response in the cache with Etag and fresh response
+PASS RequestCache "reload" mode does store the response in the cache with date and fresh response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and stale response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and stale response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and fresh response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachereloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache - reload</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="request-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ {
+ name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "stale",
+ request_cache: ["default", "reload"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "fresh",
+ request_cache: ["default", "reload"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache',
+ state: "stale",
+ request_cache: ["reload", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache',
+ state: "fresh",
+ request_cache: ["reload", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [true],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+ state: "stale",
+ request_cache: ["default", "reload", "default"],
+ expected_validation_headers: [false, false, true],
+ expected_no_cache_headers: [false, true, false],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+ state: "fresh",
+ request_cache: ["default", "reload", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,626 +0,0 @@
</span><del>-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Request cache</title>
- <meta name="help" href="https://fetch.spec.whatwg.org/#request">
- <meta name="timeout" content="long">
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <script src="/common/utils.js"></script>
- <script src="/common/get-host-info.sub.js"></script>
- </head>
- <body>
- <script>
- var now = new Date();
- /**
- * Each test is run twice: once using etag/If-None-Match and once with
- * date/If-Modified-Since. Each test run gets its own URL and randomized
- * content and operates independently.
- *
- * The test steps are run with request_cache.length fetch requests issued
- * and their immediate results sanity-checked. The cache.py server script
- * stashes an entry containing any If-None-Match, If-Modified-Since, Pragma,
- * and Cache-Control observed headers for each request it receives. When
- * the test fetches have run, this state is retrieved from cache.py and the
- * expected_* lists are checked, including their length.
- *
- * This means that if a request_* fetch is expected to hit the cache and not
- * touch the network, then there will be no entry for it in the expect_*
- * lists. AKA (request_cache.length - expected_validation_headers.length)
- * should equal the number of cache hits that didn't touch the network.
- *
- * Test dictionary keys:
- * - state: required string that determines whether the Expires response for
- * the fetched document should be set in the future ("fresh") or past
- * ("stale").
- * - vary: optional string to be passed to the server for it to quote back
- * in a Vary header on the response to us.
- * - cache_control: optional string to be passed to the server for it to
- * quote back in a Cache-Control header on the response to us.
- * - redirect: optional string "same-origin" or "cross-origin". If
- * provided, the server will issue an absolute redirect to the script on
- * the same or a different origin, as appropriate. The redirected
- * location is the script with the redirect parameter removed, so the
- * content/state/etc. will be as if you hadn't specified a redirect.
- * - request_cache: required array of cache modes to use (via `cache`).
- * - request_headers: optional array of explicit fetch `headers` arguments.
- * If provided, the server will log an empty dictionary for each request
- * instead of the request headers it would normally log.
- * - response: optional array of specialized response handling. Right now,
- * "error" array entries indicate a network error response is expected
- * which will reject with a TypeError.
- * - expected_validation_headers: required boolean array indicating whether
- * the server should have seen an If-None-Match/If-Modified-Since header
- * in the request.
- * - expected_no_cache_headers: required boolean array indicating whether
- * the server should have seen Pragma/Cache-control:no-cache headers in
- * the request.
- * - expected_max_age_headers: optional boolean array indicating whether
- * the server should have seen a Cache-Control:max-age=0 header in the
- * request.
- */
- var tests = [
- {
- name: 'RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses',
- state: "stale",
- request_cache: ["default", "default"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists',
- state: "fresh",
- request_cache: ["default", "default"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "no-cache" mode revalidates stale responses found in the cache',
- state: "stale",
- request_cache: ["default", "no-cache"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- expected_max_age_headers: [false, true],
- },
- {
- name: 'RequestCache "no-cache" mode revalidates fresh responses found in the cache',
- state: "fresh",
- request_cache: ["default", "no-cache"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- expected_max_age_headers: [false, true],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses',
- state: "stale",
- request_cache: ["default", "force-cache"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses',
- state: "fresh",
- request_cache: ["default", "force-cache"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
- state: "stale",
- request_cache: ["force-cache"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
- state: "fresh",
- request_cache: ["force-cache"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
- state: "stale",
- vary: "*",
- request_cache: ["default", "force-cache"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
- state: "fresh",
- vary: "*",
- request_cache: ["default", "force-cache"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
- state: "stale",
- request_cache: ["force-cache", "default"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
- state: "fresh",
- request_cache: ["force-cache", "default"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false],
- },
- {
- name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses',
- state: "stale",
- request_cache: ["default", "only-if-cached"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false]
- },
- {
- name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses',
- state: "fresh",
- request_cache: ["default", "only-if-cached"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [false]
- },
- {
- name: 'RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found',
- state: "fresh",
- request_cache: ["only-if-cached"],
- response: ["error"],
- expected_validation_headers: [],
- expected_no_cache_headers: []
- },
- {
- name: 'RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content',
- state: "fresh",
- request_cache: ["default", "only-if-cached"],
- redirect: "same-origin",
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content',
- state: "stale",
- request_cache: ["default", "only-if-cached"],
- redirect: "same-origin",
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects',
- state: "fresh",
- request_cache: ["default", "only-if-cached"],
- redirect: "cross-origin",
- response: [null, "error"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects',
- state: "stale",
- request_cache: ["default", "only-if-cached"],
- redirect: "cross-origin",
- response: [null, "error"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
- state: "stale",
- request_cache: ["default", "no-store"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
- state: "fresh",
- request_cache: ["default", "no-store"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "no-store" mode does not store the response in the cache',
- state: "stale",
- request_cache: ["no-store", "default"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "no-store" mode does not store the response in the cache',
- state: "fresh",
- request_cache: ["no-store", "default"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-None-Match": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-None-Match": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{"If-None-Match": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{"If-None-Match": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Match": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Match": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{"If-Match": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{"If-Match": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Range": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{}, {"If-Range": '"foo"'}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
- state: "stale",
- request_cache: ["default", "default"],
- request_headers: [{"If-Range": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
- state: "fresh",
- request_cache: ["default", "default"],
- request_headers: [{"If-Range": '"foo"'}, {}],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
- state: "stale",
- cache_control: "no-store",
- request_cache: ["default", "default"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
- state: "fresh",
- cache_control: "no-store",
- request_cache: ["default", "default"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, false],
- },
- {
- name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
- state: "stale",
- request_cache: ["default", "reload"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
- state: "fresh",
- request_cache: ["default", "reload"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- {
- name: 'RequestCache "reload" mode does store the response in the cache',
- state: "stale",
- request_cache: ["reload", "default"],
- expected_validation_headers: [false, true],
- expected_no_cache_headers: [true, false],
- },
- {
- name: 'RequestCache "reload" mode does store the response in the cache',
- state: "fresh",
- request_cache: ["reload", "default"],
- expected_validation_headers: [false],
- expected_no_cache_headers: [true],
- },
- {
- name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
- state: "stale",
- request_cache: ["default", "reload", "default"],
- expected_validation_headers: [false, false, true],
- expected_no_cache_headers: [false, true, false],
- },
- {
- name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
- state: "fresh",
- request_cache: ["default", "reload", "default"],
- expected_validation_headers: [false, false],
- expected_no_cache_headers: [false, true],
- },
- ];
- function base_path() {
- return location.pathname.replace(/\/[^\/]*$/, '/');
- }
- function make_url(uuid, id, value, content, info) {
- var dates = {
- fresh: new Date(now.getFullYear() + 1, now.getMonth(), now.getDay()).toGMTString(),
- stale: new Date(now.getFullYear() - 1, now.getMonth(), now.getDay()).toGMTString(),
- };
- var vary = "";
- if ("vary" in info) {
- vary = "&vary=" + info.vary;
- }
- var cache_control = "";
- if ("cache_control" in info) {
- cache_control = "&cache_control=" + info.cache_control;
- }
- var redirect = "";
-
- var ignore_request_headers = "";
- if ("request_headers" in info) {
- // Ignore the request headers that we send since they may be synthesized by the test.
- ignore_request_headers = "&ignore";
- }
- var url_sans_redirect = "resources/cache.py?token=" + uuid +
- "&content=" + content +
- "&" + id + "=" + value +
- "&expires=" + dates[info.state] +
- vary + cache_control + ignore_request_headers;
- // If there's a redirect, the target is the script without any redirect at
- // either the same domain or a different domain.
- if ("redirect" in info) {
- var host_info = get_host_info();
- var origin;
- switch (info.redirect) {
- case "same-origin":
- origin = host_info['HTTP_ORIGIN'];
- break;
- case "cross-origin":
- origin = host_info['HTTP_REMOTE_ORIGIN'];
- break;
- }
- var redirected_url = origin + base_path() + url_sans_redirect;
- return url_sans_redirect + "&redirect=" + encodeURIComponent(redirected_url);
- } else {
- return url_sans_redirect;
- }
- }
- function expected_status(type, identifier, init) {
- if (type == "date" &&
- init.headers &&
- init.headers["If-Modified-Since"] == identifier) {
- // The server will respond with a 304 in this case.
- return [304, "Not Modified"];
- }
- return [200, "OK"];
- }
- function expected_response_text(type, identifier, init, content) {
- if (type == "date" &&
- init.headers &&
- init.headers["If-Modified-Since"] == identifier) {
- // The server will respond with a 304 in this case.
- return "";
- }
- return content;
- }
- function server_state(uuid) {
- return fetch("resources/cache.py?querystate&token=" + uuid)
- .then(function(response) {
- return response.text();
- }).then(function(text) {
- // null will be returned if the server never received any requests
- // for the given uuid. Normalize that to an empty list consistent
- // with our representation.
- return JSON.parse(text) || [];
- });
- }
- function make_test(type, info) {
- return function(test) {
- var uuid = token();
- var identifier = (type == "tag" ? Math.random() : now.toGMTString());
- var content = Math.random().toString();
- var url = make_url(uuid, type, identifier, content, info);
- var fetch_functions = [];
- for (var i = 0; i < info.request_cache.length; ++i) {
- fetch_functions.push(function(idx) {
- var init = {cache: info.request_cache[idx]};
- if ("request_headers" in info) {
- init.headers = info.request_headers[idx];
- }
- if (init.cache === "only-if-cached") {
- // only-if-cached requires we use same-origin mode.
- init.mode = "same-origin";
- }
- return fetch(url, init)
- .then(function(response) {
- if ("response" in info && info.response[idx] === "error") {
- assert_true(false, "fetch should have been an error");
- return;
- }
- assert_array_equals([response.status, response.statusText],
- expected_status(type, identifier, init));
- return response.text();
- }).then(function(text) {
- assert_equals(text, expected_response_text(type, identifier, init, content));
- }, function(reason) {
- if ("response" in info && info.response[idx] === "error") {
- assert_throws(new TypeError(), function() { throw reason; });
- } else {
- throw reason;
- }
- });
- });
- }
- var i = 0;
- function run_next_step() {
- if (fetch_functions.length) {
- return fetch_functions.shift()(i++)
- .then(run_next_step);
- } else {
- return Promise.resolve();
- }
- }
- return run_next_step()
- .then(function() {
- // Now, query the server state
- return server_state(uuid);
- }).then(function(state) {
- var expectedState = [];
- info.expected_validation_headers.forEach(function (validate) {
- if (validate) {
- if (type == "tag") {
- expectedState.push({"If-None-Match": '"' + identifier + '"'});
- } else {
- expectedState.push({"If-Modified-Since": identifier});
- }
- } else {
- expectedState.push({});
- }
- });
- for (var i = 0; i < info.expected_no_cache_headers.length; ++i) {
- if (info.expected_no_cache_headers[i]) {
- expectedState[i]["Pragma"] = "no-cache";
- expectedState[i]["Cache-Control"] = "no-cache";
- }
- }
- if ("expected_max_age_headers" in info) {
- for (var i = 0; i < info.expected_max_age_headers.length; ++i) {
- if (info.expected_max_age_headers[i]) {
- expectedState[i]["Cache-Control"] = "max-age=0";
- }
- }
- }
- assert_equals(state.length, expectedState.length);
- for (var i = 0; i < state.length; ++i) {
- for (var header in state[i]) {
- assert_equals(state[i][header], expectedState[i][header]);
- delete expectedState[i][header];
- }
- for (var header in expectedState[i]) {
- assert_false(header in state[i]);
- }
- }
- });
- };
- }
- tests.forEach(function(info) {
- promise_test(make_test("tag", info), info.name + " with Etag and " + info.state + " response");
- promise_test(make_test("date", info), info.name + " with date and " + info.state + " response");
- });
- </script>
- </body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,223 @@
</span><ins>+/**
+ * Each test is run twice: once using etag/If-None-Match and once with
+ * date/If-Modified-Since. Each test run gets its own URL and randomized
+ * content and operates independently.
+ *
+ * The test steps are run with request_cache.length fetch requests issued
+ * and their immediate results sanity-checked. The cache.py server script
+ * stashes an entry containing any If-None-Match, If-Modified-Since, Pragma,
+ * and Cache-Control observed headers for each request it receives. When
+ * the test fetches have run, this state is retrieved from cache.py and the
+ * expected_* lists are checked, including their length.
+ *
+ * This means that if a request_* fetch is expected to hit the cache and not
+ * touch the network, then there will be no entry for it in the expect_*
+ * lists. AKA (request_cache.length - expected_validation_headers.length)
+ * should equal the number of cache hits that didn't touch the network.
+ *
+ * Test dictionary keys:
+ * - state: required string that determines whether the Expires response for
+ * the fetched document should be set in the future ("fresh") or past
+ * ("stale").
+ * - vary: optional string to be passed to the server for it to quote back
+ * in a Vary header on the response to us.
+ * - cache_control: optional string to be passed to the server for it to
+ * quote back in a Cache-Control header on the response to us.
+ * - redirect: optional string "same-origin" or "cross-origin". If
+ * provided, the server will issue an absolute redirect to the script on
+ * the same or a different origin, as appropriate. The redirected
+ * location is the script with the redirect parameter removed, so the
+ * content/state/etc. will be as if you hadn't specified a redirect.
+ * - request_cache: required array of cache modes to use (via `cache`).
+ * - request_headers: optional array of explicit fetch `headers` arguments.
+ * If provided, the server will log an empty dictionary for each request
+ * instead of the request headers it would normally log.
+ * - response: optional array of specialized response handling. Right now,
+ * "error" array entries indicate a network error response is expected
+ * which will reject with a TypeError.
+ * - expected_validation_headers: required boolean array indicating whether
+ * the server should have seen an If-None-Match/If-Modified-Since header
+ * in the request.
+ * - expected_no_cache_headers: required boolean array indicating whether
+ * the server should have seen Pragma/Cache-control:no-cache headers in
+ * the request.
+ * - expected_max_age_headers: optional boolean array indicating whether
+ * the server should have seen a Cache-Control:max-age=0 header in the
+ * request.
+ */
+
+var now = new Date();
+
+function base_path() {
+ return location.pathname.replace(/\/[^\/]*$/, '/');
+}
+function make_url(uuid, id, value, content, info) {
+ var dates = {
+ fresh: new Date(now.getFullYear() + 1, now.getMonth(), now.getDay()).toGMTString(),
+ stale: new Date(now.getFullYear() - 1, now.getMonth(), now.getDay()).toGMTString(),
+ };
+ var vary = "";
+ if ("vary" in info) {
+ vary = "&vary=" + info.vary;
+ }
+ var cache_control = "";
+ if ("cache_control" in info) {
+ cache_control = "&cache_control=" + info.cache_control;
+ }
+ var redirect = "";
+
+ var ignore_request_headers = "";
+ if ("request_headers" in info) {
+ // Ignore the request headers that we send since they may be synthesized by the test.
+ ignore_request_headers = "&ignore";
+ }
+ var url_sans_redirect = "resources/cache.py?token=" + uuid +
+ "&content=" + content +
+ "&" + id + "=" + value +
+ "&expires=" + dates[info.state] +
+ vary + cache_control + ignore_request_headers;
+ // If there's a redirect, the target is the script without any redirect at
+ // either the same domain or a different domain.
+ if ("redirect" in info) {
+ var host_info = get_host_info();
+ var origin;
+ switch (info.redirect) {
+ case "same-origin":
+ origin = host_info['HTTP_ORIGIN'];
+ break;
+ case "cross-origin":
+ origin = host_info['HTTP_REMOTE_ORIGIN'];
+ break;
+ }
+ var redirected_url = origin + base_path() + url_sans_redirect;
+ return url_sans_redirect + "&redirect=" + encodeURIComponent(redirected_url);
+ } else {
+ return url_sans_redirect;
+ }
+}
+function expected_status(type, identifier, init) {
+ if (type == "date" &&
+ init.headers &&
+ init.headers["If-Modified-Since"] == identifier) {
+ // The server will respond with a 304 in this case.
+ return [304, "Not Modified"];
+ }
+ return [200, "OK"];
+}
+function expected_response_text(type, identifier, init, content) {
+ if (type == "date" &&
+ init.headers &&
+ init.headers["If-Modified-Since"] == identifier) {
+ // The server will respond with a 304 in this case.
+ return "";
+ }
+ return content;
+}
+function server_state(uuid) {
+ return fetch("resources/cache.py?querystate&token=" + uuid)
+ .then(function(response) {
+ return response.text();
+ }).then(function(text) {
+ // null will be returned if the server never received any requests
+ // for the given uuid. Normalize that to an empty list consistent
+ // with our representation.
+ return JSON.parse(text) || [];
+ });
+}
+function make_test(type, info) {
+ return function(test) {
+ var uuid = token();
+ var identifier = (type == "tag" ? Math.random() : now.toGMTString());
+ var content = Math.random().toString();
+ var url = make_url(uuid, type, identifier, content, info);
+ var fetch_functions = [];
+ for (var i = 0; i < info.request_cache.length; ++i) {
+ fetch_functions.push(function(idx) {
+ var init = {cache: info.request_cache[idx]};
+ if ("request_headers" in info) {
+ init.headers = info.request_headers[idx];
+ }
+ if (init.cache === "only-if-cached") {
+ // only-if-cached requires we use same-origin mode.
+ init.mode = "same-origin";
+ }
+ return fetch(url, init)
+ .then(function(response) {
+ if ("response" in info && info.response[idx] === "error") {
+ assert_true(false, "fetch should have been an error");
+ return;
+ }
+ assert_array_equals([response.status, response.statusText],
+ expected_status(type, identifier, init));
+ return response.text();
+ }).then(function(text) {
+ assert_equals(text, expected_response_text(type, identifier, init, content));
+ }, function(reason) {
+ if ("response" in info && info.response[idx] === "error") {
+ assert_throws(new TypeError(), function() { throw reason; });
+ } else {
+ throw reason;
+ }
+ });
+ });
+ }
+ var i = 0;
+ function run_next_step() {
+ if (fetch_functions.length) {
+ return fetch_functions.shift()(i++)
+ .then(run_next_step);
+ } else {
+ return Promise.resolve();
+ }
+ }
+ return run_next_step()
+ .then(function() {
+ // Now, query the server state
+ return server_state(uuid);
+ }).then(function(state) {
+ var expectedState = [];
+ info.expected_validation_headers.forEach(function (validate) {
+ if (validate) {
+ if (type == "tag") {
+ expectedState.push({"If-None-Match": '"' + identifier + '"'});
+ } else {
+ expectedState.push({"If-Modified-Since": identifier});
+ }
+ } else {
+ expectedState.push({});
+ }
+ });
+ for (var i = 0; i < info.expected_no_cache_headers.length; ++i) {
+ if (info.expected_no_cache_headers[i]) {
+ expectedState[i]["Pragma"] = "no-cache";
+ expectedState[i]["Cache-Control"] = "no-cache";
+ }
+ }
+ if ("expected_max_age_headers" in info) {
+ for (var i = 0; i < info.expected_max_age_headers.length; ++i) {
+ if (info.expected_max_age_headers[i]) {
+ expectedState[i]["Cache-Control"] = "max-age=0";
+ }
+ }
+ }
+ assert_equals(state.length, expectedState.length);
+ for (var i = 0; i < state.length; ++i) {
+ for (var header in state[i]) {
+ assert_equals(state[i][header], expectedState[i][header]);
+ delete expectedState[i][header];
+ }
+ for (var header in expectedState[i]) {
+ assert_false(header in state[i]);
+ }
+ }
+ });
+ };
+}
+
+function run_tests(tests)
+{
+ tests.forEach(function(info) {
+ promise_test(make_test("tag", info), info.name + " with Etag and " + info.state + " response");
+ promise_test(make_test("date", info), info.name + " with date and " + info.state + " response");
+ });
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -2520,7 +2520,8 @@
</span><span class="cx">
</span><span class="cx"> webkit.org/b/156561 perf/rel-list-remove.html [ Pass Timeout Failure ]
</span><span class="cx">
</span><del>-webkit.org/b/159683 imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Pass Failure ]
</del><ins>+webkit.org/b/163332 imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html [ Pass Failure ]
+webkit.org/b/163332 imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html [ Pass Failure ]
</ins><span class="cx">
</span><span class="cx"> webkit.org/b/158640 imported/blink/storage/indexeddb/blob-valid-after-deletion.html [ Pass Failure ]
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsfetchapirequestrequestcacheonlyifcachedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Etag and stale response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with date and stale response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with Etag and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with date and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Etag and fresh response
+PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with date and fresh response
+FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and fresh response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and stale response
+PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and stale response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsfetchapirequestrequestcachereloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt (0 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and stale response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and stale response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with Etag and fresh response
+PASS RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless with date and fresh response
+PASS RequestCache "reload" mode does store the response in the cache with Etag and stale response
+PASS RequestCache "reload" mode does store the response in the cache with date and stale response
+FAIL RequestCache "reload" mode does store the response in the cache with Etag and fresh response assert_equals: expected 1 but got 2
+FAIL RequestCache "reload" mode does store the response in the cache with date and fresh response assert_equals: expected 1 but got 2
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and stale response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and stale response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and fresh response
+PASS RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and fresh response
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/platform/win/TestExpectations        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -3494,7 +3494,8 @@
</span><span class="cx"> imported/w3c/web-platform-tests/fetch/api/credentials/cookies-worker.html [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html [ Failure ]
</span><del>-imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Failure ]
</del><ins>+imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html [ Failure ]
+imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html [ Failure ]
</ins><span class="cx"> imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_forward_1.html [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_go_no_argument.html [ Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -685,7 +685,7 @@
</span><span class="cx"> http/tests/misc/will-send-request-with-client-provided-http-body.html [ Pass ]
</span><span class="cx">
</span><span class="cx"> # bug 162281
</span><del>-imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Skip ]
</del><ins>+imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html [ Failure ]
</ins><span class="cx">
</span><span class="cx"> ### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
</span><span class="cx"> ########################################
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/ChangeLog        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-10-14 Youenn Fablet <youenn@apple.com>
+
+ Make NetworkCache aware of fetch cache mode
+ https://bugs.webkit.org/show_bug.cgi?id=163332
+
+ Reviewed by Antti Koivisto.
+
+ Tests: imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html
+ imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::updateRequestAccordingCacheMode): Setting request cache policy according cache mode.
+ Basically, these two are about the same.
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy): Making use of cache policy instead of cache mode.
+ * platform/network/ResourceRequestBase.h: Adding new cache policies, aligned with fetch cache modes.
+ * platform/network/cf/ResourceRequestCFNet.cpp:
+ (WebCore::toPlatformRequestCachePolicy): If policy is not supported by CFNetwork, fallback to ReloadIgnoringCacheData.
+ This is the best approximate we might find.
+ (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
+ (WebCore::ResourceRequest::doUpdateResourceRequest): Only updating cache policy, if cache policy is the default.
+ * platform/network/cf/ResourceRequestCFNet.h:
+ * platform/network/cocoa/ResourceRequestCocoa.mm: Doing the same modifications as for ResourceRequestCFNet.
+ (WebCore::ResourceRequest::doUpdateResourceRequest):
+ (WebCore::toPlatformRequestCachePolicy):
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+
</ins><span class="cx"> 2016-10-13 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><span class="cx"> Binding generated code for private operations should assert for casted-this checks
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -835,7 +835,7 @@
</span><span class="cx"> {
</span><span class="cx"> auto& memoryCache = MemoryCache::singleton();
</span><span class="cx"> ASSERT(!request.allowsCaching() || !memoryCache.resourceForRequest(request.resourceRequest(), sessionID())
</span><del>- || request.options().cache == FetchOptions::Cache::NoCache || request.options().cache == FetchOptions::Cache::NoStore || request.options().cache == FetchOptions::Cache::Reload);
</del><ins>+ || request.resourceRequest().cachePolicy() == DoNotUseAnyCache || request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData || request.resourceRequest().cachePolicy() == RefreshAnyCacheData);
</ins><span class="cx">
</span><span class="cx"> LOG(ResourceLoading, "Loading CachedResource for '%s'.", request.resourceRequest().url().stringCenterEllipsizedToLength().latin1().data());
</span><span class="cx">
</span><span class="lines">@@ -888,10 +888,10 @@
</span><span class="cx"> if (!existingResource)
</span><span class="cx"> return Load;
</span><span class="cx">
</span><del>- if (cachedResourceRequest.options().cache == FetchOptions::Cache::NoStore)
</del><ins>+ if (request.cachePolicy() == DoNotUseAnyCache || request.cachePolicy() == ReloadIgnoringCacheData)
</ins><span class="cx"> return Load;
</span><span class="cx">
</span><del>- if (cachedResourceRequest.options().cache == FetchOptions::Cache::Reload)
</del><ins>+ if (request.cachePolicy() == RefreshAnyCacheData)
</ins><span class="cx"> return Reload;
</span><span class="cx">
</span><span class="cx"> // We already have a preload going for this URL.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -153,12 +153,12 @@
</span><span class="cx">
</span><span class="cx"> switch (m_options.cache) {
</span><span class="cx"> case FetchOptions::Cache::NoCache:
</span><del>- m_resourceRequest.setCachePolicy(ReloadIgnoringCacheData);
</del><ins>+ m_resourceRequest.setCachePolicy(RefreshAnyCacheData);
</ins><span class="cx"> m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::CacheControl, HTTPHeaderValues::maxAge0());
</span><span class="cx"> break;
</span><span class="cx"> case FetchOptions::Cache::NoStore:
</span><span class="cx"> m_options.cachingPolicy = CachingPolicy::DisallowCaching;
</span><del>- m_resourceRequest.setCachePolicy(ReloadIgnoringCacheData);
</del><ins>+ m_resourceRequest.setCachePolicy(DoNotUseAnyCache);
</ins><span class="cx"> m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::Pragma, HTTPHeaderValues::noCache());
</span><span class="cx"> m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::CacheControl, HTTPHeaderValues::noCache());
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -36,10 +36,12 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> enum ResourceRequestCachePolicy {
</span><del>- UseProtocolCachePolicy, // normal load
- ReloadIgnoringCacheData, // reload
- ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data
- ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache
</del><ins>+ UseProtocolCachePolicy, // normal load, equivalent to fetch "default" cache mode.
+ ReloadIgnoringCacheData, // reload, equivalent to fetch "reload"cache mode.
+ ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data, equivalent to fetch "force-cache" cache mode.
+ ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache, equivalent to fetch "only-if-cached" cache mode.
+ DoNotUseAnyCache, // Bypass the cache entirely, equivalent to fetch "no-store" cache mode.
+ RefreshAnyCacheData, // Serve cache data only if revalidated, equivalent to fetch "no-cache" mode.
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum HTTPBodyUpdatePolicy {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceRequestCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -170,6 +170,20 @@
</span><span class="cx"> m_cfRequest = adoptCF(cfRequest);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline CFURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy)
+{
+ switch (policy) {
+ case UseProtocolCachePolicy:
+ return CFURLRequestUseProtocolCachePolicy;
+ case ReturnCacheDataElseLoad:
+ return CFURLRequestReturnCacheDataElseLoad;
+ case ReturnCacheDataDontLoad:
+ return CFURLRequestReturnCacheDataDontLoad;
+ default:
+ return CFURLRequestReloadIgnoringLocalCacheData;
+ }
+}
+
</ins><span class="cx"> void ResourceRequest::doUpdatePlatformHTTPBody()
</span><span class="cx"> {
</span><span class="cx"> CFMutableURLRequestRef cfRequest;
</span><span class="lines">@@ -180,7 +194,7 @@
</span><span class="cx"> cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
</span><span class="cx"> CFURLRequestSetURL(cfRequest, url.get());
</span><span class="cx"> CFURLRequestSetMainDocumentURL(cfRequest, firstPartyForCookies.get());
</span><del>- CFURLRequestSetCachePolicy(cfRequest, (CFURLRequestCachePolicy)cachePolicy());
</del><ins>+ CFURLRequestSetCachePolicy(cfRequest, toPlatformRequestCachePolicy(cachePolicy()));
</ins><span class="cx"> CFURLRequestSetTimeoutInterval(cfRequest, timeoutInterval());
</span><span class="cx"> } else
</span><span class="cx"> cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), firstPartyForCookies.get());
</span><span class="lines">@@ -211,7 +225,8 @@
</span><span class="cx">
</span><span class="cx"> m_url = CFURLRequestGetURL(m_cfRequest.get());
</span><span class="cx">
</span><del>- m_cachePolicy = (ResourceRequestCachePolicy)CFURLRequestGetCachePolicy(m_cfRequest.get());
</del><ins>+ if (!m_cachePolicy)
+ m_cachePolicy = (ResourceRequestCachePolicy)CFURLRequestGetCachePolicy(m_cfRequest.get());
</ins><span class="cx"> m_timeoutInterval = CFURLRequestGetTimeoutInterval(m_cfRequest.get());
</span><span class="cx"> m_firstPartyForCookies = CFURLRequestGetMainDocumentURL(m_cfRequest.get());
</span><span class="cx"> if (CFStringRef method = CFURLRequestCopyHTTPRequestMethod(m_cfRequest.get())) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceRequestCFNeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx"> * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CFNetworkSPI.h"
</span><span class="cx"> #include "ResourceLoadPriority.h"
</span><ins>+#include "ResourceRequestBase.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcocoaResourceRequestCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -61,10 +61,40 @@
</span><span class="cx"> return [nsURLRequest(bodyPolicy) _CFURLRequest];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline ResourceRequestCachePolicy fromPlatformRequestCachePolicy(NSURLRequestCachePolicy policy)
+{
+ switch (policy) {
+ case NSURLRequestUseProtocolCachePolicy:
+ return UseProtocolCachePolicy;
+ case NSURLRequestReturnCacheDataElseLoad:
+ return ReturnCacheDataElseLoad;
+ case NSURLRequestReturnCacheDataDontLoad:
+ return ReturnCacheDataDontLoad;
+ default:
+ return ReloadIgnoringCacheData;
+ }
+}
+
+static inline NSURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy)
+{
+ switch (policy) {
+ case UseProtocolCachePolicy:
+ return NSURLRequestUseProtocolCachePolicy;
+ case ReturnCacheDataElseLoad:
+ return NSURLRequestReturnCacheDataElseLoad;
+ case ReturnCacheDataDontLoad:
+ return NSURLRequestReturnCacheDataDontLoad;
+ default:
+ return NSURLRequestReloadIgnoringLocalCacheData;
+ }
+}
+
</ins><span class="cx"> void ResourceRequest::doUpdateResourceRequest()
</span><span class="cx"> {
</span><span class="cx"> m_url = [m_nsRequest.get() URL];
</span><del>- m_cachePolicy = (ResourceRequestCachePolicy)[m_nsRequest.get() cachePolicy];
</del><ins>+
+ if (!m_cachePolicy)
+ m_cachePolicy = fromPlatformRequestCachePolicy([m_nsRequest.get() cachePolicy]);
</ins><span class="cx"> m_timeoutInterval = [m_nsRequest.get() timeoutInterval];
</span><span class="cx"> m_firstPartyForCookies = [m_nsRequest.get() mainDocumentURL];
</span><span class="cx">
</span><span class="lines">@@ -132,7 +162,7 @@
</span><span class="cx"> if (ResourceRequest::resourcePrioritiesEnabled())
</span><span class="cx"> CFURLRequestSetRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(priority()));
</span><span class="cx">
</span><del>- [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
</del><ins>+ [nsRequest setCachePolicy:toPlatformRequestCachePolicy(cachePolicy())];
</ins><span class="cx"> _CFURLRequestSetProtocolProperty([nsRequest _CFURLRequest], kCFURLRequestAllowAllPOSTCaching, kCFBooleanTrue);
</span><span class="cx">
</span><span class="cx"> double timeoutInterval = ResourceRequestBase::timeoutInterval();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebKit2/ChangeLog        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-10-14 Youenn Fablet <youenn@apple.com>
+
+ Make NetworkCache aware of fetch cache mode
+ https://bugs.webkit.org/show_bug.cgi?id=163332
+
+ Reviewed by Antti Koivisto.
+
+ Adding explicit serialization of ResourceRequest cachePolicy since it does no longer map to platform request cache policy.
+
+ Added support for:
+ - Bypassing entirely the network cache in case cache mode is NoStore.
+ - requiring revalidation in case of cache hit and cache mode is NoCache.
+ - Not using any entry if cache mode is Reload (but cache can still be updated)
+
+ Also made sure that the ResourceRequest::cachePolicy remains the same throughout redirections.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::canUseCache):
+ (WebKit::NetworkResourceLoader::retrieveCacheEntry):
+ (WebKit::NetworkResourceLoader::continueWillSendRequest):
+ * NetworkProcess/cache/NetworkCache.cpp:
+ (WebKit::NetworkCache::cachePolicyAllowsExpired):
+ (WebKit::NetworkCache::makeRetrieveDecision):
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
+ (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
+
</ins><span class="cx"> 2016-10-13 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename the SPI added in r207292 due to post-landing review comments
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -122,6 +122,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> if (!request.url().protocolIsInHTTPFamily())
</span><span class="cx"> return false;
</span><ins>+ if (originalRequest().cachePolicy() == WebCore::DoNotUseAnyCache)
+ return false;
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -188,7 +190,7 @@
</span><span class="cx"> loader->startNetworkLoad(request);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- if (entry->needsValidation()) {
</del><ins>+ if (entry->needsValidation() || request.cachePolicy() == WebCore::RefreshAnyCacheData) {
</ins><span class="cx"> loader->validateCacheEntry(WTFMove(entry));
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -471,6 +473,9 @@
</span><span class="cx"> {
</span><span class="cx"> RELEASE_LOG_IF_ALLOWED("continueWillSendRequest: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier);
</span><span class="cx">
</span><ins>+ // If there is a match in the network cache, we need to reuse the original cache policy.
+ newRequest.setCachePolicy(originalRequest().cachePolicy());
+
</ins><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="cx"> if (m_isWaitingContinueWillSendRequestForCachedRedirect) {
</span><span class="cx"> LOG(NetworkCache, "(NetworkProcess) Retrieving cached redirect");
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -136,9 +136,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> case WebCore::UseProtocolCachePolicy:
</span><span class="cx"> case WebCore::ReloadIgnoringCacheData:
</span><ins>+ case WebCore::RefreshAnyCacheData:
</ins><span class="cx"> return false;
</span><ins>+ case WebCore::DoNotUseAnyCache:
+ ASSERT_NOT_REACHED();
+ return false;
</ins><span class="cx"> }
</span><del>- ASSERT_NOT_REACHED();
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -198,6 +201,8 @@
</span><span class="cx">
</span><span class="cx"> static RetrieveDecision makeRetrieveDecision(const WebCore::ResourceRequest& request)
</span><span class="cx"> {
</span><ins>+ ASSERT(request.cachePolicy() != WebCore::DoNotUseAnyCache);
+
</ins><span class="cx"> // FIXME: Support HEAD requests.
</span><span class="cx"> if (request.httpMethod() != "GET")
</span><span class="cx"> return RetrieveDecision::NoDueToHTTPMethod;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (207329 => 207330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2016-10-14 07:10:00 UTC (rev 207329)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2016-10-14 08:47:16 UTC (rev 207330)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx"> // The fallback array is part of NSURLRequest, but it is not encoded by WKNSURLRequestCreateSerializableRepresentation.
</span><span class="cx"> encoder << resourceRequest.responseContentDispositionEncodingFallbackArray();
</span><span class="cx"> encoder.encodeEnum(resourceRequest.requester());
</span><ins>+ encoder.encodeEnum(resourceRequest.cachePolicy());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ArgumentCoder<ResourceRequest>::decodePlatformData(Decoder& decoder, ResourceRequest& resourceRequest)
</span><span class="lines">@@ -115,6 +116,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> resourceRequest.setRequester(requester);
</span><span class="cx">
</span><ins>+ ResourceRequestCachePolicy cachePolicy;
+ if (!decoder.decodeEnum(cachePolicy))
+ return false;
+ resourceRequest.setCachePolicy(cachePolicy);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>