WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fixing assert and builds
bug-163332-20161013145646.patch (text/plain), 122.33 KB, created by
youenn fablet
on 2016-10-13 06:00:15 PDT
(
hide
)
Description:
Fixing assert and builds
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2016-10-13 06:00:15 PDT
Size:
122.33 KB
patch
obsolete
>Subversion Revision: 207281 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b5077d16928c70a2b89c8eff46224494cde8746f..78a3fa2295c56f3d26e8a16a927c00ffeb909383 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,5 +1,36 @@ > 2016-10-13 Youenn Fablet <youenn@apple.com> > >+ Make NetworkCache aware of fetch cache mode >+ https://bugs.webkit.org/show_bug.cgi?id=163332 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ >+2016-10-13 Youenn Fablet <youenn@apple.com> >+ > Remove CachedResourceRequest::mutableResourceRequest > https://bugs.webkit.org/show_bug.cgi?id=163277 > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 16425fe77b1fdead1ee5efa4c6453da8c5c8e863..3c69bf053fc7aa155623ff94e4ba572f9c311509 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,30 @@ >+2016-10-13 Youenn Fablet <youenn@apple.com> >+ >+ Make NetworkCache aware of fetch cache mode >+ https://bugs.webkit.org/show_bug.cgi?id=163332 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ > 2016-10-12 Chris Dumez <cdumez@apple.com> > > [Web IDL] Drop support for legacy [ConstructorConditional=*] >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >index eb4500205bb2a5b8b1750853c20c431ff5f9b58a..2d673dd1a9b6783dcf0163b38ec42f2de15a68da 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >@@ -835,7 +835,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe > { > auto& memoryCache = MemoryCache::singleton(); > ASSERT(!request.allowsCaching() || !memoryCache.resourceForRequest(request.resourceRequest(), sessionID()) >- || request.options().cache == FetchOptions::Cache::NoCache || request.options().cache == FetchOptions::Cache::NoStore || request.options().cache == FetchOptions::Cache::Reload); >+ || request.resourceRequest().cachePolicy() == DoNotUseAnyCache || request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData || request.resourceRequest().cachePolicy() == RefreshAnyCacheData); > > LOG(ResourceLoading, "Loading CachedResource for '%s'.", request.resourceRequest().url().stringCenterEllipsizedToLength().latin1().data()); > >@@ -888,10 +888,10 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida > if (!existingResource) > return Load; > >- if (cachedResourceRequest.options().cache == FetchOptions::Cache::NoStore) >+ if (request.cachePolicy() == DoNotUseAnyCache || request.cachePolicy() == ReloadIgnoringCacheData) > return Load; > >- if (cachedResourceRequest.options().cache == FetchOptions::Cache::Reload) >+ if (request.cachePolicy() == RefreshAnyCacheData) > return Reload; > > // We already have a preload going for this URL. >diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.cpp b/Source/WebCore/loader/cache/CachedResourceRequest.cpp >index 0c3406f46f21ab266041b1b472c5f2aa35a90c2e..1dc2257af7a44f5d8e5a4139ac435104b64ecf08 100644 >--- a/Source/WebCore/loader/cache/CachedResourceRequest.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceRequest.cpp >@@ -153,12 +153,12 @@ void CachedResourceRequest::updateAccordingCacheMode() > > switch (m_options.cache) { > case FetchOptions::Cache::NoCache: >- m_resourceRequest.setCachePolicy(ReloadIgnoringCacheData); >+ m_resourceRequest.setCachePolicy(RefreshAnyCacheData); > m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::CacheControl, HTTPHeaderValues::maxAge0()); > break; > case FetchOptions::Cache::NoStore: > m_options.cachingPolicy = CachingPolicy::DisallowCaching; >- m_resourceRequest.setCachePolicy(ReloadIgnoringCacheData); >+ m_resourceRequest.setCachePolicy(DoNotUseAnyCache); > m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::Pragma, HTTPHeaderValues::noCache()); > m_resourceRequest.addHTTPHeaderFieldIfNotPresent(HTTPHeaderName::CacheControl, HTTPHeaderValues::noCache()); > break; >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h >index 49fb67f745262c9c49bcd0387972f99895dbce8b..96c5fbdbbea0d035f47517d2a4e0f3f5d862672c 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.h >+++ b/Source/WebCore/platform/network/ResourceRequestBase.h >@@ -36,10 +36,12 @@ > namespace WebCore { > > enum ResourceRequestCachePolicy { >- 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 >+ 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. > }; > > enum HTTPBodyUpdatePolicy { >diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp >index abc1d7249f3ce3a9f6dce298a16d016b531ddd48..d85e9b02dcb96a2845c298732034755d84020ef7 100644 >--- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp >@@ -170,6 +170,11 @@ void ResourceRequest::doUpdatePlatformRequest() > m_cfRequest = adoptCF(cfRequest); > } > >+static inline CFURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) >+{ >+ return (CFURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); >+} >+ > void ResourceRequest::doUpdatePlatformHTTPBody() > { > CFMutableURLRequestRef cfRequest; >@@ -180,7 +185,7 @@ void ResourceRequest::doUpdatePlatformHTTPBody() > cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get()); > CFURLRequestSetURL(cfRequest, url.get()); > CFURLRequestSetMainDocumentURL(cfRequest, firstPartyForCookies.get()); >- CFURLRequestSetCachePolicy(cfRequest, (CFURLRequestCachePolicy)cachePolicy()); >+ CFURLRequestSetCachePolicy(cfRequest, toPlatformRequestCachePolicy(cachePolicy())); > CFURLRequestSetTimeoutInterval(cfRequest, timeoutInterval()); > } else > cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), firstPartyForCookies.get()); >@@ -211,7 +216,8 @@ void ResourceRequest::doUpdateResourceRequest() > > m_url = CFURLRequestGetURL(m_cfRequest.get()); > >- m_cachePolicy = (ResourceRequestCachePolicy)CFURLRequestGetCachePolicy(m_cfRequest.get()); >+ if (!m_cachePolicy) >+ m_cachePolicy = (ResourceRequestCachePolicy)CFURLRequestGetCachePolicy(m_cfRequest.get()); > m_timeoutInterval = CFURLRequestGetTimeoutInterval(m_cfRequest.get()); > m_firstPartyForCookies = CFURLRequestGetMainDocumentURL(m_cfRequest.get()); > if (CFStringRef method = CFURLRequestCopyHTTPRequestMethod(m_cfRequest.get())) { >diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h >index cdd674b41a858f30553f901197c65d3312503c60..c2884664473152e99cc2540b5ecf2c3a9f9d8496 100644 >--- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h >+++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h >@@ -20,13 +20,14 @@ > * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY > * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > > #pragma once > > #include "CFNetworkSPI.h" > #include "ResourceLoadPriority.h" >+#include "ResourceRequestBase.h" > > namespace WebCore { > >diff --git a/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm b/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >index 7593ab3523083fdfd75873ac193e4e8a682d490a..4167775b2e7ca562c22dd160eb7a69e1d0d16dc5 100644 >--- a/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >@@ -64,7 +64,9 @@ CFURLRequestRef ResourceRequest::cfURLRequest(HTTPBodyUpdatePolicy bodyPolicy) c > void ResourceRequest::doUpdateResourceRequest() > { > m_url = [m_nsRequest.get() URL]; >- m_cachePolicy = (ResourceRequestCachePolicy)[m_nsRequest.get() cachePolicy]; >+ >+ if (!m_cachePolicy) >+ m_cachePolicy = (ResourceRequestCachePolicy)[m_nsRequest.get() cachePolicy]; > m_timeoutInterval = [m_nsRequest.get() timeoutInterval]; > m_firstPartyForCookies = [m_nsRequest.get() mainDocumentURL]; > >@@ -112,6 +114,11 @@ void ResourceRequest::doUpdateResourceHTTPBody() > } > } > >+static inline NSURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) >+{ >+ return (NSURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); >+} >+ > void ResourceRequest::doUpdatePlatformRequest() > { > if (isNull()) { >@@ -132,7 +139,7 @@ void ResourceRequest::doUpdatePlatformRequest() > if (ResourceRequest::resourcePrioritiesEnabled()) > CFURLRequestSetRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(priority())); > >- [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; >+ [nsRequest setCachePolicy:toPlatformRequestCachePolicy(cachePolicy())]; > _CFURLRequestSetProtocolProperty([nsRequest _CFURLRequest], kCFURLRequestAllowAllPOSTCaching, kCFBooleanTrue); > > double timeoutInterval = ResourceRequestBase::timeoutInterval(); >diff --git a/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp >index 2cbef9e5b33a0545936ffd127823e31e5277e387..952184f2556bbdeb26db0395b065108e34f737a1 100644 >--- a/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp >+++ b/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp >@@ -122,6 +122,8 @@ bool NetworkResourceLoader::canUseCache(const ResourceRequest& request) const > return false; > if (!request.url().protocolIsInHTTPFamily()) > return false; >+ if (originalRequest().cachePolicy() == WebCore::DoNotUseAnyCache) >+ return false; > > return true; > } >@@ -188,7 +190,7 @@ void NetworkResourceLoader::retrieveCacheEntry(const ResourceRequest& request) > loader->startNetworkLoad(request); > return; > } >- if (entry->needsValidation()) { >+ if (entry->needsValidation() || request.cachePolicy() == WebCore::RefreshAnyCacheData) { > loader->validateCacheEntry(WTFMove(entry)); > return; > } >@@ -471,6 +473,9 @@ void NetworkResourceLoader::continueWillSendRequest(ResourceRequest&& newRequest > { > RELEASE_LOG_IF_ALLOWED("continueWillSendRequest: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier); > >+ // If there is a match in the network cache, we need to reuse the original cache policy. >+ newRequest.setCachePolicy(originalRequest().cachePolicy()); >+ > #if ENABLE(NETWORK_CACHE) > if (m_isWaitingContinueWillSendRequestForCachedRedirect) { > LOG(NetworkCache, "(NetworkProcess) Retrieving cached redirect"); >diff --git a/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp b/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp >index 240380f798a71bd12aef9fbfafcb01212d973ef9..dfe5c4658a912cd3d5d05d288c8ebaaec8fdd658 100644 >--- a/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp >+++ b/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp >@@ -136,9 +136,12 @@ static bool cachePolicyAllowsExpired(WebCore::ResourceRequestCachePolicy policy) > return true; > case WebCore::UseProtocolCachePolicy: > case WebCore::ReloadIgnoringCacheData: >+ case WebCore::RefreshAnyCacheData: >+ return false; >+ case WebCore::DoNotUseAnyCache: >+ ASSERT_NOT_REACHED(); > return false; > } >- ASSERT_NOT_REACHED(); > return false; > } > >@@ -198,6 +201,8 @@ static UseDecision makeUseDecision(const Entry& entry, const WebCore::ResourceRe > > static RetrieveDecision makeRetrieveDecision(const WebCore::ResourceRequest& request) > { >+ ASSERT(request.cachePolicy() != WebCore::DoNotUseAnyCache); >+ > // FIXME: Support HEAD requests. > if (request.httpMethod() != "GET") > return RetrieveDecision::NoDueToHTTPMethod; >diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm >index 69e7a6ffccb9565978b55c5b16fc4c0af2bf9b35..9cedce86c0d9aaec28622c97e30a214186c5d2da 100644 >--- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm >+++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm >@@ -77,6 +77,7 @@ void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const > // The fallback array is part of NSURLRequest, but it is not encoded by WKNSURLRequestCreateSerializableRepresentation. > encoder << resourceRequest.responseContentDispositionEncodingFallbackArray(); > encoder.encodeEnum(resourceRequest.requester()); >+ encoder.encodeEnum(resourceRequest.cachePolicy()); > } > > bool ArgumentCoder<ResourceRequest>::decodePlatformData(Decoder& decoder, ResourceRequest& resourceRequest) >@@ -115,6 +116,11 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(Decoder& decoder, Resour > return false; > resourceRequest.setRequester(requester); > >+ ResourceRequestCachePolicy cachePolicy; >+ if (!decoder.decodeEnum(cachePolicy)) >+ return false; >+ resourceRequest.setCachePolicy(cachePolicy); >+ > return true; > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 087731b208e4c7dd92a9703e4c31d2be39ea629f..738827ffb6674e7000165aecbd3b02239d347474 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2016-10-13 Youenn Fablet <youenn@apple.com> >+ >+ Make NetworkCache aware of fetch cache mode >+ https://bugs.webkit.org/show_bug.cgi?id=163332 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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: >+ > 2016-10-13 Antti Koivisto <antti@apple.com> > > Support scoped style for user agent shadow trees >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index d82b3e07af1044c190c0bd3f9ef164d3207f138c..c125238c93fd080d04774626d54506639597db67 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,38 @@ >+2016-10-13 Youenn Fablet <youenn@apple.com> >+ >+ Make NetworkCache aware of fetch cache mode >+ https://bugs.webkit.org/show_bug.cgi?id=163332 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ > 2016-10-11 Chris Dumez <cdumez@apple.com> > > select.options may return too many option elements >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..55809df7bf2c0fdf861caa48f64133b02280a307 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional-expected.txt >@@ -0,0 +1,42 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7b2a7bd31ae5bfccddf90cbed20665b85c0097e8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html >@@ -0,0 +1,180 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e7044ec94d1c340357f8095e2cee0509268d1724 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-expected.txt >@@ -0,0 +1,10 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c0e37b2d0c9b6382dfc72b1c6b90197b3e5e015d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html >@@ -0,0 +1,50 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt >deleted file mode 100644 >index 5529cb0e0e27b55b53e255fa49204532fdd1861d..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt >+++ /dev/null >@@ -1,104 +0,0 @@ >- >-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 >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6b158127094c5b428d0d19460bf8e28193b721a8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache-expected.txt >@@ -0,0 +1,18 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ed45726f55e652306b7826129f4bcee98403e334 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html >@@ -0,0 +1,78 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..551c45529be65fb69dfb1d5a71f1df4ade080350 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache-expected.txt >@@ -0,0 +1,6 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d30ed16269686ae7163853a795d529fb4d869b41 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html >@@ -0,0 +1,36 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..96eb7220eeb7f42edf19309205873996abfe1b1f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store-expected.txt >@@ -0,0 +1,10 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html >new file mode 100644 >index 0000000000000000000000000000000000000000..396b6a650905def403a062a237fc760ddcda70aa >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html >@@ -0,0 +1,48 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..379b457ebe27d6d80e71d99967aa6c9830f51d5a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >@@ -0,0 +1,24 @@ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html >new file mode 100644 >index 0000000000000000000000000000000000000000..adb31a397a759c43f918c0f88a7f2067bfac33a8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html >@@ -0,0 +1,76 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1d02257b3a1ff91bd1d4ddf867be19f4fa6e17a3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt >@@ -0,0 +1,14 @@ >+ >+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 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html >new file mode 100644 >index 0000000000000000000000000000000000000000..45ff5832482dd971b4062100414d0b2187e478e0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html >@@ -0,0 +1,62 @@ >+<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html >deleted file mode 100644 >index f2c442a54094e0f640c112a97053cfd170bec7df..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html >+++ /dev/null >@@ -1,626 +0,0 @@ >-<!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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js >new file mode 100644 >index 0000000000000000000000000000000000000000..deeb17d1b50a11cd397eb787620c02a73f5abe9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.js >@@ -0,0 +1,223 @@ >+/** >+ * 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"); >+ }); >+} >diff --git a/LayoutTests/platform/ios-simulator/TestExpectations b/LayoutTests/platform/ios-simulator/TestExpectations >index cd1f2629140ab868fb699c4e0df95b0fdd1b86e2..b4368cf185fcf6f076157a49f2dc7532ac7930f6 100644 >--- a/LayoutTests/platform/ios-simulator/TestExpectations >+++ b/LayoutTests/platform/ios-simulator/TestExpectations >@@ -2520,7 +2520,8 @@ webkit.org/b/157592 fast/images/composited-animated-gif-outside-viewport.html [ > > webkit.org/b/156561 perf/rel-list-remove.html [ Pass Timeout Failure ] > >-webkit.org/b/159683 imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Pass Failure ] >+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 ] > > webkit.org/b/158640 imported/blink/storage/indexeddb/blob-valid-after-deletion.html [ Pass Failure ] > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9e478862642230372ee6354f99dcc53a80d3fd09 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >@@ -0,0 +1,16 @@ >+ >+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 >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6451995e3a7acf0d6e4a833d850150b1c2dcdeb9 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload-expected.txt >@@ -0,0 +1,14 @@ >+ >+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 >+ >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index 8b75b7d8b775c28a22ef938ef80cc2d9998a1924..11e1b300093a3cf3ff671b58ec82a3ce174e66b6 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -3494,7 +3494,8 @@ imported/w3c/web-platform-tests/fetch/api/credentials/cookies.html [ Failure ] > imported/w3c/web-platform-tests/fetch/api/credentials/cookies-worker.html [ Failure ] > imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html [ Failure ] > imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html [ Failure ] >-imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Failure ] >+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 ] > imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html [ Failure ] > imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_forward_1.html [ Failure ] > imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_go_no_argument.html [ Failure ] >diff --git a/LayoutTests/platform/wk2/TestExpectations b/LayoutTests/platform/wk2/TestExpectations >index 17569dd5028d43eb3b1d9f086d119a54e22600c5..9480583d10ac4502d0bed162072ad87c628739ec 100644 >--- a/LayoutTests/platform/wk2/TestExpectations >+++ b/LayoutTests/platform/wk2/TestExpectations >@@ -685,7 +685,7 @@ fast/images/gif-loop-count.html [ Pass ] > http/tests/misc/will-send-request-with-client-provided-http-body.html [ Pass ] > > # bug 162281 >-imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Skip ] >+imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html [ Failure ] > > ### END OF (5) Progressions, expected successes that are expected failures in WebKit1. > ########################################
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 163332
:
291357
|
291469
|
291472
|
291473
|
291475
|
291583
|
291586