Backed out 8 changesets (bug 1120715) for Android dom/u2f/tests/test_no_token.html permafail.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 10 Mar 2016 20:20:05 -0500
changeset 288147 60633fe1415f
parent 288146 47c57a3f7007
child 288148 84481a45eb01
push id73325
push userryanvm@gmail.com
push dateFri, 11 Mar 2016 01:20:48 +0000
treeherdermozilla-inbound@60633fe1415f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1120715
milestone48.0a1
backs out043770204431
e10c375353f4
c2871dbeb7cc
79158f028ad3
c74866f52320
c731944ecc64
44f346712a3a
60d6045125e2
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 8 changesets (bug 1120715) for Android dom/u2f/tests/test_no_token.html permafail. Backed out changeset 043770204431 (bug 1120715) Backed out changeset e10c375353f4 (bug 1120715) Backed out changeset c2871dbeb7cc (bug 1120715) Backed out changeset 79158f028ad3 (bug 1120715) Backed out changeset c74866f52320 (bug 1120715) Backed out changeset c731944ecc64 (bug 1120715) Backed out changeset 44f346712a3a (bug 1120715) Backed out changeset 60d6045125e2 (bug 1120715) CLOSED TREE
dom/cache/test/mochitest/driver.js
dom/cache/test/xpcshell/head.js
dom/fetch/FetchDriver.cpp
dom/fetch/InternalHeaders.cpp
dom/fetch/InternalHeaders.h
dom/fetch/InternalRequest.cpp
dom/fetch/InternalRequest.h
dom/fetch/Request.cpp
dom/fetch/Request.h
dom/tests/mochitest/fetch/fetch_test_framework.js
dom/tests/mochitest/fetch/mochitest.ini
dom/tests/mochitest/fetch/sw_reroute.js
dom/tests/mochitest/fetch/test_request_cache.html
dom/webidl/Request.webidl
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerPrivate.cpp
dom/workers/WorkerPrefs.h
modules/libpref/init/all.js
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/HttpBaseChannel.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsIHttpChannelInternal.idl
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/fetch/api/request/request-idl.html.ini
testing/web-platform/meta/fetch/api/request/request-structure.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-event-test-worker.js
testing/web-platform/tests/fetch/api/request/request-cache.html
testing/web-platform/tests/fetch/api/request/resources/cache.py
--- a/dom/cache/test/mochitest/driver.js
+++ b/dom/cache/test/mochitest/driver.js
@@ -17,16 +17,17 @@
 // when the returned promise is resolved.
 
 function runTests(testFile, order) {
   function setupPrefs() {
     return new Promise(function(resolve, reject) {
       SpecialPowers.pushPrefEnv({
         "set": [["dom.caches.enabled", true],
                 ["dom.caches.testing.enabled", true],
+                ["dom.requestcache.enabled", true],
                 ["dom.serviceWorkers.enabled", true],
                 ["dom.serviceWorkers.testing.enabled", true],
                 ["dom.serviceWorkers.exemptFromPerDomainMax", true]]
       }, function() {
         resolve();
       });
     });
   }
--- a/dom/cache/test/xpcshell/head.js
+++ b/dom/cache/test/xpcshell/head.js
@@ -13,16 +13,19 @@ var Cu = Components.utils;
 // services required be initialized in order to run CacheStorage
 var ss = Cc['@mozilla.org/storage/service;1']
          .createInstance(Ci.mozIStorageService);
 var sts = Cc['@mozilla.org/network/stream-transport-service;1']
           .getService(Ci.nsIStreamTransportService);
 var hash = Cc['@mozilla.org/security/hash;1']
            .createInstance(Ci.nsICryptoHash);
 
+var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
+prefs.setBoolPref("dom.requestcache.enabled", true);
+
 // Expose Cache and Fetch symbols on the global
 Cu.importGlobalProperties(['caches', 'fetch']);
 
 // Extract a zip file into the profile
 function create_test_profile(zipFileName) {
   do_get_profile();
 
   var directoryService = Cc['@mozilla.org/file/directory_service;1']
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -240,16 +240,22 @@ FetchDriver::HttpFetch()
   {
     nsCOMPtr<nsIInterfaceRequestor> notificationCallbacks;
     chan->GetNotificationCallbacks(getter_AddRefs(notificationCallbacks));
     MOZ_ASSERT(!notificationCallbacks);
   }
 #endif
   chan->SetNotificationCallbacks(this);
 
+  // FIXME(nsm): Bug 1120715.
+  // Step 3.4 "If request's cache mode is default and request's header list
+  // contains a header named `If-Modified-Since`, `If-None-Match`,
+  // `If-Unmodified-Since`, `If-Match`, or `If-Range`, set request's cache mode
+  // to no-store."
+
   // Step 3.5 begins "HTTP network or cache fetch".
   // HTTP network or cache fetch
   // ---------------------------
   // Step 1 "Let HTTPRequest..." The channel is the HTTPRequest.
   nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(chan);
   if (httpChan) {
     // Copy the method.
     nsAutoCString method;
@@ -321,21 +327,21 @@ FetchDriver::HttpFetch()
     // Credentials checks for CORS are handled by nsCORSListenerProxy,
 
     nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
 
     // Conversion between enumerations is safe due to static asserts in
     // dom/workers/ServiceWorkerManager.cpp
     internalChan->SetCorsMode(static_cast<uint32_t>(mRequest->Mode()));
     internalChan->SetRedirectMode(static_cast<uint32_t>(mRequest->GetRedirectMode()));
-    mRequest->MaybeSkipCacheIfPerformingRevalidation();
-    internalChan->SetFetchCacheMode(static_cast<uint32_t>(mRequest->GetCacheMode()));
   }
 
   // Step 5. Proxy authentication will be handled by Necko.
+  // FIXME(nsm): Bug 1120715.
+  // Step 7-10. "If request's cache mode is neither no-store nor reload..."
 
   // Continue setting up 'HTTPRequest'. Content-Type and body data.
   nsCOMPtr<nsIUploadChannel2> uploadChan = do_QueryInterface(chan);
   if (uploadChan) {
     nsAutoCString contentType;
     ErrorResult result;
     mRequest->Headers()->Get(NS_LITERAL_CSTRING("content-type"), contentType, result);
     // This is an error because the Request constructor explicitly extracts and
--- a/dom/fetch/InternalHeaders.cpp
+++ b/dom/fetch/InternalHeaders.cpp
@@ -169,27 +169,16 @@ InternalHeaders::IsSimpleHeader(const ns
   // from being set or appended.
   return aName.EqualsLiteral("accept") ||
          aName.EqualsLiteral("accept-language") ||
          aName.EqualsLiteral("content-language") ||
          (aName.EqualsLiteral("content-type") &&
           nsContentUtils::IsAllowedNonCorsContentType(aValue));
 }
 
-// static
-bool
-InternalHeaders::IsRevalidationHeader(const nsACString& aName)
-{
-  return aName.EqualsLiteral("if-modified-since") ||
-         aName.EqualsLiteral("if-none-match") ||
-         aName.EqualsLiteral("if-unmodified-since") ||
-         aName.EqualsLiteral("if-match") ||
-         aName.EqualsLiteral("if-range");
-}
-
 //static
 bool
 InternalHeaders::IsInvalidName(const nsACString& aName, ErrorResult& aRv)
 {
   if (!NS_IsValidHTTPToken(aName)) {
     NS_ConvertUTF8toUTF16 label(aName);
     aRv.ThrowTypeError<MSG_INVALID_HEADER_NAME>(label);
     return true;
@@ -289,28 +278,16 @@ InternalHeaders::HasOnlySimpleHeaders() 
     if (!IsSimpleHeader(mList[i].mName, mList[i].mValue)) {
       return false;
     }
   }
 
   return true;
 }
 
-bool
-InternalHeaders::HasRevalidationHeaders() const
-{
-  for (uint32_t i = 0; i < mList.Length(); ++i) {
-    if (IsRevalidationHeader(mList[i].mName)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
 // static
 already_AddRefed<InternalHeaders>
 InternalHeaders::BasicHeaders(InternalHeaders* aHeaders)
 {
   RefPtr<InternalHeaders> basic = new InternalHeaders(*aHeaders);
   ErrorResult result;
   // The Set-Cookie headers cannot be invalid mutable headers, so the Delete
   // must succeed.
--- a/dom/fetch/InternalHeaders.h
+++ b/dom/fetch/InternalHeaders.h
@@ -94,18 +94,16 @@ public:
   void SetGuard(HeadersGuardEnum aGuard, ErrorResult& aRv);
 
   void Fill(const InternalHeaders& aInit, ErrorResult& aRv);
   void Fill(const Sequence<Sequence<nsCString>>& aInit, ErrorResult& aRv);
   void Fill(const MozMap<nsCString>& aInit, ErrorResult& aRv);
 
   bool HasOnlySimpleHeaders() const;
 
-  bool HasRevalidationHeaders() const;
-
   static already_AddRefed<InternalHeaders>
   BasicHeaders(InternalHeaders* aHeaders);
 
   static already_AddRefed<InternalHeaders>
   CORSHeaders(InternalHeaders* aHeaders);
 
   void
   GetEntries(nsTArray<InternalHeaders::Entry>& aEntries) const;
@@ -139,16 +137,14 @@ private:
            IsImmutable(aRv) ||
            IsForbiddenRequestHeader(aName) ||
            IsForbiddenRequestNoCorsHeader(aName, aValue) ||
            IsForbiddenResponseHeader(aName);
   }
 
   static bool IsSimpleHeader(const nsACString& aName,
                              const nsACString& aValue);
-
-  static bool IsRevalidationHeader(const nsACString& aName);
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_InternalHeaders_h
--- a/dom/fetch/InternalRequest.cpp
+++ b/dom/fetch/InternalRequest.cpp
@@ -358,19 +358,10 @@ InternalRequest::MapChannelToRequestCred
   } else if (cookiePolicy == nsILoadInfo::SEC_COOKIES_SAME_ORIGIN) {
     return RequestCredentials::Same_origin;
   }
 
   MOZ_ASSERT_UNREACHABLE("Unexpected cookie policy!");
   return RequestCredentials::Same_origin;
 }
 
-void
-InternalRequest::MaybeSkipCacheIfPerformingRevalidation()
-{
-  if (mCacheMode == RequestCache::Default &&
-      mHeaders->HasRevalidationHeaders()) {
-    mCacheMode = RequestCache::No_store;
-  }
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/fetch/InternalRequest.h
+++ b/dom/fetch/InternalRequest.h
@@ -112,33 +112,32 @@ public:
     , mUnsafeRequest(false)
     , mUseURLCredentials(false)
   {
   }
 
   InternalRequest(const nsACString& aURL,
                   const nsACString& aMethod,
                   already_AddRefed<InternalHeaders> aHeaders,
-                  RequestCache aCacheMode,
                   RequestMode aMode,
                   RequestRedirect aRequestRedirect,
                   RequestCredentials aRequestCredentials,
                   const nsAString& aReferrer,
                   ReferrerPolicy aReferrerPolicy,
                   nsContentPolicyType aContentPolicyType)
     : mMethod(aMethod)
     , mURL(aURL)
     , mHeaders(aHeaders)
     , mContentPolicyType(aContentPolicyType)
     , mReferrer(aReferrer)
     , mReferrerPolicy(aReferrerPolicy)
     , mMode(aMode)
     , mCredentialsMode(aRequestCredentials)
     , mResponseTainting(LoadTainting::Basic)
-    , mCacheMode(aCacheMode)
+    , mCacheMode(RequestCache::Default)
     , mRedirectMode(aRequestRedirect)
     , mAuthenticationFlag(false)
     , mForceOriginHeader(false)
     , mPreserveContentCodings(false)
       // FIXME See the above comment in the default constructor.
     , mSameOriginDataURL(true)
     , mSkipServiceWorker(false)
     , mSynchronous(false)
@@ -420,19 +419,16 @@ public:
   IsNavigationRequest() const;
 
   bool
   IsWorkerRequest() const;
 
   bool
   IsClientRequest() const;
 
-  void
-  MaybeSkipCacheIfPerformingRevalidation();
-
   static RequestMode
   MapChannelToRequestMode(nsIChannel* aChannel);
 
   static RequestCredentials
   MapChannelToRequestCredentials(nsIChannel* aChannel);
 
 private:
   // Does not copy mBodyStream.  Use fallible Clone() for complete copy.
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -59,16 +59,35 @@ Request::RequestContextEnabled(JSContext
   WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
   if (!workerPrivate) {
     return false;
   }
 
   return workerPrivate->RequestContextEnabled();
 }
 
+// static
+bool
+Request::RequestCacheEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.requestcache.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->RequestCacheEnabled();
+}
+
 already_AddRefed<InternalRequest>
 Request::GetInternalRequest()
 {
   RefPtr<InternalRequest> r = mRequest;
   return r.forget();
 }
 
 namespace {
--- a/dom/fetch/Request.h
+++ b/dom/fetch/Request.h
@@ -31,16 +31,18 @@ class Request final : public nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Request)
 
 public:
   Request(nsIGlobalObject* aOwner, InternalRequest* aRequest);
 
   static bool
   RequestContextEnabled(JSContext* aCx, JSObject* aObj);
+  static bool
+  RequestCacheEnabled(JSContext* aCx, JSObject* aObj);
 
   JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return RequestBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void
--- a/dom/tests/mochitest/fetch/fetch_test_framework.js
+++ b/dom/tests/mochitest/fetch/fetch_test_framework.js
@@ -2,17 +2,18 @@ function testScript(script) {
   // reroute.html should have set this variable if a service worker is present!
   if (!("isSWPresent" in window)) {
     window.isSWPresent = false;
   }
 
   function setupPrefs() {
     return new Promise(function(resolve, reject) {
       SpecialPowers.pushPrefEnv({
-        "set": [["dom.requestcontext.enabled", true],
+        "set": [["dom.requestcache.enabled", true],
+                ["dom.requestcontext.enabled", true],
                 ["dom.serviceWorkers.enabled", true],
                 ["dom.serviceWorkers.testing.enabled", true],
                 ["dom.serviceWorkers.exemptFromPerDomainMax", true]]
       }, resolve);
     });
   }
 
   function workerTest() {
--- a/dom/tests/mochitest/fetch/mochitest.ini
+++ b/dom/tests/mochitest/fetch/mochitest.ini
@@ -45,16 +45,18 @@ skip-if = buildapp == 'b2g' || (toolkit 
 [test_fetch_cors_sw_empty_reroute.html]
 skip-if = buildapp == 'b2g' || (toolkit == 'android' && debug) # Bug 1210282
 [test_formdataparsing.html]
 skip-if = (e10s && debug && os == 'win')
 [test_formdataparsing_sw_reroute.html]
 skip-if = buildapp == 'b2g' || (e10s && debug && os == 'win') # Bug 1137683
 [test_request.html]
 skip-if = (e10s && debug && os == 'win')
+[test_request_cache.html]
+skip-if = (e10s && debug && os == 'win')
 [test_request_context.html]
 skip-if = (e10s && debug && os == 'win')
 [test_request_sw_reroute.html]
 skip-if = buildapp == 'b2g' || (e10s && debug && os == 'win') # Bug 1137683
 [test_response.html]
 skip-if = (e10s && debug && os == 'win')
 [test_response_sw_reroute.html]
 skip-if = buildapp == 'b2g' || (e10s && debug && os == 'win') # Bug 1137683
--- a/dom/tests/mochitest/fetch/sw_reroute.js
+++ b/dom/tests/mochitest/fetch/sw_reroute.js
@@ -5,17 +5,18 @@ function testScript(script) {
     gRegistration = registration;
 
     var iframe = document.createElement("iframe");
     iframe.src = "reroute.html?" + script.replace(".js", "");
     document.body.appendChild(iframe);
   }
 
   SpecialPowers.pushPrefEnv({
-    "set": [["dom.serviceWorkers.enabled", true],
+    "set": [["dom.requestcache.enabled", true],
+            ["dom.serviceWorkers.enabled", true],
             ["dom.serviceWorkers.testing.enabled", true],
             ["dom.serviceWorkers.exemptFromPerDomainMax", true]]
   }, function() {
     navigator.serviceWorker.ready.then(setupSW);
     var scriptURL = location.href.includes("sw_empty_reroute.html")
                   ? "empty.js" : "reroute.js";
     navigator.serviceWorker.register(scriptURL, {scope: "/"});
   });
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/fetch/test_request_cache.html
@@ -0,0 +1,19 @@
+<!--
+  Any copyright is dedicated to the Public Domain.
+  http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Make sure that Request.cache is not exposed by default</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script>
+var req = new Request("");
+ok(!("cache" in req), "Request.cache should not be exposed by default");
+</script>
+</body>
+</html>
+
--- a/dom/webidl/Request.webidl
+++ b/dom/webidl/Request.webidl
@@ -18,16 +18,17 @@ interface Request {
   [SameObject] readonly attribute Headers headers;
 
   [Func="mozilla::dom::Request::RequestContextEnabled"]
   readonly attribute RequestContext context;
   readonly attribute USVString referrer;
   readonly attribute ReferrerPolicy referrerPolicy;
   readonly attribute RequestMode mode;
   readonly attribute RequestCredentials credentials;
+  [Func="mozilla::dom::Request::RequestCacheEnabled"]
   readonly attribute RequestCache cache;
   readonly attribute RequestRedirect redirect;
 
   [Throws,
    NewObject] Request clone();
 
   // Bug 1124638 - Allow chrome callers to set the context.
   [ChromeOnly]
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -107,29 +107,16 @@ static_assert(nsIHttpChannelInternal::RE
               "RequestRedirect enumeration value should make Necko Redirect mode value.");
 static_assert(nsIHttpChannelInternal::REDIRECT_MODE_ERROR == static_cast<uint32_t>(RequestRedirect::Error),
               "RequestRedirect enumeration value should make Necko Redirect mode value.");
 static_assert(nsIHttpChannelInternal::REDIRECT_MODE_MANUAL == static_cast<uint32_t>(RequestRedirect::Manual),
               "RequestRedirect enumeration value should make Necko Redirect mode value.");
 static_assert(3 == static_cast<uint32_t>(RequestRedirect::EndGuard_),
               "RequestRedirect enumeration value should make Necko Redirect mode value.");
 
-static_assert(nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT == static_cast<uint32_t>(RequestCache::Default),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-static_assert(nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_STORE == static_cast<uint32_t>(RequestCache::No_store),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-static_assert(nsIHttpChannelInternal::FETCH_CACHE_MODE_RELOAD == static_cast<uint32_t>(RequestCache::Reload),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-static_assert(nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_CACHE == static_cast<uint32_t>(RequestCache::No_cache),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-static_assert(nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE == static_cast<uint32_t>(RequestCache::Force_cache),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-static_assert(5 == static_cast<uint32_t>(RequestCache::EndGuard_),
-             "RequestCache enumeration value should match Necko Cache mode value.");
-
 static StaticRefPtr<ServiceWorkerManager> gInstance;
 
 struct ServiceWorkerManager::RegistrationDataPerPrincipal final
 {
   // Ordered list of scopes for glob matching.
   // Each entry is an absolute URL representing the scope.
   // Each value of the hash table is an array of an absolute URLs representing
   // the scopes.
--- a/dom/workers/ServiceWorkerPrivate.cpp
+++ b/dom/workers/ServiceWorkerPrivate.cpp
@@ -985,17 +985,16 @@ class FetchEventRunnable : public Extend
   nsMainThreadPtrHandle<nsIInterceptedChannel> mInterceptedChannel;
   const nsCString mScriptSpec;
   nsTArray<nsCString> mHeaderNames;
   nsTArray<nsCString> mHeaderValues;
   nsCString mSpec;
   nsCString mMethod;
   nsString mClientId;
   bool mIsReload;
-  RequestCache mCacheMode;
   RequestMode mRequestMode;
   RequestRedirect mRequestRedirect;
   RequestCredentials mRequestCredentials;
   nsContentPolicyType mContentPolicyType;
   nsCOMPtr<nsIInputStream> mUploadStream;
   nsCString mReferrer;
   ReferrerPolicy mReferrerPolicy;
 public:
@@ -1009,17 +1008,16 @@ public:
                      const nsAString& aDocumentId,
                      bool aIsReload)
     : ExtendableFunctionalEventWorkerRunnable(
         aWorkerPrivate, aKeepAliveToken, aRegistration)
     , mInterceptedChannel(aChannel)
     , mScriptSpec(aScriptSpec)
     , mClientId(aDocumentId)
     , mIsReload(aIsReload)
-    , mCacheMode(RequestCache::Default)
     , mRequestMode(RequestMode::No_cors)
     , mRequestRedirect(RequestRedirect::Follow)
     // By default we set it to same-origin since normal HTTP fetches always
     // send credentials to same-origin websites unless explicitly forbidden.
     , mRequestCredentials(RequestCredentials::Same_origin)
     , mContentPolicyType(nsIContentPolicy::TYPE_INVALID)
     , mReferrer(kFETCH_CLIENT_REFERRER_STR)
     , mReferrerPolicy(ReferrerPolicy::_empty)
@@ -1107,26 +1105,21 @@ public:
     rv = httpChannel->GetRequestMethod(mMethod);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIHttpChannelInternal> internalChannel = do_QueryInterface(httpChannel);
     NS_ENSURE_TRUE(internalChannel, NS_ERROR_NOT_AVAILABLE);
 
     mRequestMode = InternalRequest::MapChannelToRequestMode(channel);
 
-    // This is safe due to static_asserts in ServiceWorkerManager.cpp.
+    // This is safe due to static_asserts at top of file.
     uint32_t redirectMode;
     internalChannel->GetRedirectMode(&redirectMode);
     mRequestRedirect = static_cast<RequestRedirect>(redirectMode);
 
-    // This is safe due to static_asserts in ServiceWorkerManager.cpp.
-    uint32_t cacheMode;
-    internalChannel->GetFetchCacheMode(&cacheMode);
-    mCacheMode = static_cast<RequestCache>(cacheMode);
-
     mRequestCredentials = InternalRequest::MapChannelToRequestCredentials(channel);
 
     rv = httpChannel->VisitNonDefaultRequestHeaders(this);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(httpChannel);
     if (uploadChannel) {
       MOZ_ASSERT(!mUploadStream);
@@ -1208,17 +1201,16 @@ private:
     if (NS_WARN_IF(result.Failed())) {
       result.SuppressException();
       return false;
     }
 
     RefPtr<InternalRequest> internalReq = new InternalRequest(mSpec,
                                                               mMethod,
                                                               internalHeaders.forget(),
-                                                              mCacheMode,
                                                               mRequestMode,
                                                               mRequestRedirect,
                                                               mRequestCredentials,
                                                               NS_ConvertUTF8toUTF16(mReferrer),
                                                               mReferrerPolicy,
                                                               mContentPolicyType);
     internalReq->SetBody(mUploadStream);
     // For Telemetry, note that this Request object was created by a Fetch event.
--- a/dom/workers/WorkerPrefs.h
+++ b/dom/workers/WorkerPrefs.h
@@ -28,16 +28,17 @@ WORKER_SIMPLE_PREF("dom.caches.enabled",
 WORKER_SIMPLE_PREF("dom.caches.testing.enabled", DOMCachesTestingEnabled, DOM_CACHES_TESTING)
 WORKER_SIMPLE_PREF("dom.performance.enable_user_timing_logging", PerformanceLoggingEnabled, PERFORMANCE_LOGGING_ENABLED)
 WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
 WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
 WORKER_SIMPLE_PREF("dom.serviceWorkers.enabled", ServiceWorkersEnabled, SERVICEWORKERS_ENABLED)
 WORKER_SIMPLE_PREF("dom.serviceWorkers.testing.enabled", ServiceWorkersTestingEnabled, SERVICEWORKERS_TESTING_ENABLED)
 WORKER_SIMPLE_PREF("dom.serviceWorkers.openWindow.enabled", OpenWindowEnabled, OPEN_WINDOW_ENABLED)
 WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
+WORKER_SIMPLE_PREF("dom.requestcache.enabled", RequestCacheEnabled, REQUESTCACHE_ENABLED)
 WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
 WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
 WORKER_PREF("dom.workers.latestJSVersion", JSVersionChanged)
 WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
 WORKER_PREF("general.appname.override", AppNameOverrideChanged)
 WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
 WORKER_PREF("general.platform.override", PlatformOverrideChanged)
 #ifdef JS_GC_ZEAL
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5209,16 +5209,19 @@ pref("memory.report_concurrency", 1);
 #else
 // Desktop probably doesn't have swapped-out children like that.
 pref("memory.report_concurrency", 10);
 #endif
 
 // Add Mozilla AudioChannel APIs.
 pref("media.useAudioChannelAPI", false);
 
+// Expose Request.cache. Currently disabled since the implementation is incomplete.
+pref("dom.requestcache.enabled", false);
+
 // Expose Request.context. Currently disabled since the spec is in flux.
 pref("dom.requestcontext.enabled", false);
 
 pref("dom.mozKillSwitch.enabled", false);
 
 pref("toolkit.pageThumbs.screenSizeDivisor", 7);
 pref("toolkit.pageThumbs.minWidth", 0);
 pref("toolkit.pageThumbs.minHeight", 0);
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -96,17 +96,16 @@ HttpBaseChannel::HttpBaseChannel()
   , mContentDispositionHint(UINT32_MAX)
   , mHttpHandler(gHttpHandler)
   , mReferrerPolicy(REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE)
   , mRedirectCount(0)
   , mForcePending(false)
   , mCorsIncludeCredentials(false)
   , mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
   , mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
-  , mFetchCacheMode(nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT)
   , mOnStartRequestCalled(false)
   , mTransferSize(0)
   , mDecodedBodySize(0)
   , mEncodedBodySize(0)
   , mRequireCORSPreflight(false)
   , mReportCollector(new ConsoleReportCollector())
   , mForceMainDocumentChannel(false)
 {
@@ -2326,57 +2325,16 @@ HttpBaseChannel::GetRedirectMode(uint32_
 
 NS_IMETHODIMP
 HttpBaseChannel::SetRedirectMode(uint32_t aMode)
 {
   mRedirectMode = aMode;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-HttpBaseChannel::GetFetchCacheMode(uint32_t* aFetchCacheMode)
-{
-  *aFetchCacheMode = mFetchCacheMode;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-HttpBaseChannel::SetFetchCacheMode(uint32_t aFetchCacheMode)
-{
-  ENSURE_CALLED_BEFORE_CONNECT();
-  MOZ_ASSERT(mFetchCacheMode == nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT,
-             "SetFetchCacheMode() should only be called once per channel");
-
-  mFetchCacheMode = aFetchCacheMode;
-
-  // Now, set the load flags that implement each cache mode.
-  switch (mFetchCacheMode) {
-  case nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_STORE:
-    // no-store means don't consult the cache on the way to the network, and
-    // don't store the response in the cache even if it's cacheable.
-    mLoadFlags |= INHIBIT_CACHING | LOAD_BYPASS_CACHE;
-    break;
-  case nsIHttpChannelInternal::FETCH_CACHE_MODE_RELOAD:
-    // reload means don't consult the cache on the way to the network, but
-    // do store the response in the cache if possible.
-    mLoadFlags |= LOAD_BYPASS_CACHE;
-    break;
-  case nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_CACHE:
-    // no-cache means always validate what's in the cache.
-    mLoadFlags |= VALIDATE_ALWAYS;
-    break;
-  case nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE:
-    // force-cache means don't validate unless if the response would vary.
-    mLoadFlags |= LOAD_FROM_CACHE;
-    break;
-  }
-
-  return NS_OK;
-}
-
 //-----------------------------------------------------------------------------
 // HttpBaseChannel::nsISupportsPriority
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpBaseChannel::GetPriority(int32_t *value)
 {
   *value = mPriority;
@@ -2850,19 +2808,16 @@ HttpBaseChannel::SetupReplacementChannel
         httpInternal->SetCacheKeysRedirectChain(mRedirectedCachekeys.forget());
     }
 
     // Preserve CORS mode flag.
     httpInternal->SetCorsMode(mCorsMode);
 
     // Preserve Redirect mode flag.
     httpInternal->SetRedirectMode(mRedirectMode);
-
-    // Preserve Cache mode flag.
-    httpInternal->SetFetchCacheMode(mFetchCacheMode);
   }
 
   // transfer application cache information
   nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
     do_QueryInterface(newChannel);
   if (appCacheChannel) {
     appCacheChannel->SetApplicationCache(mApplicationCache);
     appCacheChannel->SetInheritApplicationCache(mInheritApplicationCache);
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -211,18 +211,16 @@ public:
   NS_IMETHOD ForcePending(bool aForcePending) override;
   NS_IMETHOD GetLastModifiedTime(PRTime* lastModifiedTime) override;
   NS_IMETHOD GetCorsIncludeCredentials(bool* aInclude) override;
   NS_IMETHOD SetCorsIncludeCredentials(bool aInclude) override;
   NS_IMETHOD GetCorsMode(uint32_t* aCorsMode) override;
   NS_IMETHOD SetCorsMode(uint32_t aCorsMode) override;
   NS_IMETHOD GetRedirectMode(uint32_t* aRedirectMode) override;
   NS_IMETHOD SetRedirectMode(uint32_t aRedirectMode) override;
-  NS_IMETHOD GetFetchCacheMode(uint32_t* aFetchCacheMode) override;
-  NS_IMETHOD SetFetchCacheMode(uint32_t aFetchCacheMode) override;
   NS_IMETHOD GetTopWindowURI(nsIURI **aTopWindowURI) override;
   NS_IMETHOD GetProxyURI(nsIURI **proxyURI) override;
   virtual void SetCorsPreflightParameters(const nsTArray<nsCString>& unsafeHeaders) override;
 
   inline void CleanRedirectCacheChainIfNecessary()
   {
       mRedirectedCachekeys = nullptr;
   }
@@ -484,17 +482,16 @@ protected:
   nsCOMPtr<nsIPrincipal>            mPrincipal;
 
   bool                              mForcePending;
   nsCOMPtr<nsIURI>                  mTopWindowURI;
 
   bool mCorsIncludeCredentials;
   uint32_t mCorsMode;
   uint32_t mRedirectMode;
-  uint32_t mFetchCacheMode;
 
   // This parameter is used to ensure that we do not call OnStartRequest more
   // than once.
   bool mOnStartRequestCalled;
 
   uint64_t mTransferSize;
   uint64_t mDecodedBodySize;
   uint64_t mEncodedBodySize;
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3030,20 +3030,16 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
         GetCallback(controller);
 
         RefPtr<InterceptedChannelChrome> intercepted =
                 new InterceptedChannelChrome(this, controller, entry);
         intercepted->NotifyController();
     } else {
         if (mInterceptCache == INTERCEPTED) {
             cacheEntryOpenFlags |= nsICacheStorage::OPEN_INTERCEPTED;
-            // Clear OPEN_TRUNCATE for the fake cache entry, since otherwise
-            // cache storage will close the current entry which breaks the
-            // response synthesis.
-            cacheEntryOpenFlags &= ~nsICacheStorage::OPEN_TRUNCATE;
             DebugOnly<bool> exists;
             MOZ_ASSERT(NS_SUCCEEDED(cacheStorage->Exists(openURI, extension, &exists)) && exists,
                        "The entry must exist in the cache after we create it here");
         }
         rv = cacheStorage->AsyncOpenURI(openURI, extension, cacheEntryOpenFlags, this);
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
--- a/netwerk/protocol/http/nsIHttpChannelInternal.idl
+++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl
@@ -237,28 +237,16 @@ interface nsIHttpChannelInternal : nsISu
     const unsigned long REDIRECT_MODE_MANUAL = 2;
     /**
      * Set to indicate Request.redirect mode exposed during ServiceWorker
      * interception. No policy enforcement is performed by the channel for this
      * value.
      */
     attribute unsigned long redirectMode;
 
-    const unsigned long FETCH_CACHE_MODE_DEFAULT = 0;
-    const unsigned long FETCH_CACHE_MODE_NO_STORE = 1;
-    const unsigned long FETCH_CACHE_MODE_RELOAD = 2;
-    const unsigned long FETCH_CACHE_MODE_NO_CACHE = 3;
-    const unsigned long FETCH_CACHE_MODE_FORCE_CACHE = 4;
-    /**
-     * Set to indicate Request.cache mode, which simulates the fetch API
-     * semantics, and is also used for exposing this value to the Web page
-     * during service worker interception.
-     */
-    attribute unsigned long fetchCacheMode;
-
     /**
      * The URI of the top-level window that's associated with this channel.
      */
     readonly attribute nsIURI topWindowURI;
 
     /**
      * The network interface id that's associated with this channel.
      */
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -15525,20 +15525,16 @@
         "path": "fetch/api/redirect/redirect-mode-worker.html",
         "url": "/fetch/api/redirect/redirect-mode-worker.html"
       },
       {
         "path": "fetch/api/redirect/redirect-mode.html",
         "url": "/fetch/api/redirect/redirect-mode.html"
       },
       {
-        "path": "fetch/api/request/request-cache.html",
-        "url": "/fetch/api/request/request-cache.html"
-      },
-      {
         "path": "fetch/api/request/request-clone.sub.html",
         "url": "/fetch/api/request/request-clone.sub.html"
       },
       {
         "path": "fetch/api/request/request-consume.html",
         "url": "/fetch/api/request/request-consume.html"
       },
       {
@@ -34734,23 +34730,16 @@
     "deleted": [],
     "items": {
       "testharness": {
         "dom/collections/HTMLCollection-supported-property-indices.html": [
           {
             "path": "dom/collections/HTMLCollection-supported-property-indices.html",
             "url": "/dom/collections/HTMLCollection-supported-property-indices.html"
           }
-        ],
-        "fetch/api/request/request-cache.html": [
-          {
-            "path": "fetch/api/request/request-cache.html",
-            "timeout": "long",
-            "url": "/fetch/api/request/request-cache.html"
-          }
         ]
       }
     },
     "reftest_nodes": {}
   },
   "reftest_nodes": {
     "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
       {
--- a/testing/web-platform/meta/fetch/api/request/request-idl.html.ini
+++ b/testing/web-platform/meta/fetch/api/request/request-idl.html.ini
@@ -1,20 +1,26 @@
 [request-idl.html]
   type: testharness
   [Request interface: attribute type]
     expected: FAIL
 
   [Request interface: attribute destination]
     expected: FAIL
 
+  [Request interface: attribute cache]
+    expected: FAIL
+
   [Request interface: attribute integrity]
     expected: FAIL
 
   [Request interface: new Request("") must inherit property "type" with the proper type (3)]
     expected: FAIL
 
   [Request interface: new Request("") must inherit property "destination" with the proper type (4)]
     expected: FAIL
 
+  [Request interface: new Request("") must inherit property "cache" with the proper type (9)]
+    expected: FAIL
+
   [Request interface: new Request("") must inherit property "integrity" with the proper type (11)]
     expected: FAIL
 
--- a/testing/web-platform/meta/fetch/api/request/request-structure.html.ini
+++ b/testing/web-platform/meta/fetch/api/request/request-structure.html.ini
@@ -1,11 +1,14 @@
 [request-structure.html]
   type: testharness
   [Check type attribute]
     expected: FAIL
 
   [Check destination attribute]
     expected: FAIL
 
+  [Check cache attribute]
+    expected: FAIL
+
   [Check integrity attribute]
     expected: FAIL
 
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event.https.html
@@ -422,45 +422,10 @@ async_test(function(t) {
             'Fragment Not Found',
             'Service worker should not expose URL fragments.');
           frame.remove();
           return service_worker_unregister_and_done(t, scope);
         })
       .catch(unreached_rejection(t));
   }, 'Service Worker must not expose FetchEvent URL fragments.');
 
-async_test(function(t) {
-    var scope = 'resources/simple.html?cache';
-    var frame;
-    var cacheTypes = [
-      undefined, 'default', 'no-store', 'reload', 'no-cache', 'force-cache'
-    ];
-    service_worker_unregister_and_register(t, worker, scope)
-      .then(function(reg) {
-          return wait_for_state(t, reg.installing, 'activated');
-        })
-      .then(function() { return with_iframe(scope); })
-      .then(function(f) {
-          frame = f;
-          var tests = cacheTypes.map(function(type) {
-            return new Promise(function(resolve) {
-                return frame.contentWindow.fetch(scope + '=' + type,
-                                                 {cache: type})
-                  .then(function(response) { return response.text(); })
-                  .then(function(response_text) {
-                      var expected = (type === undefined) ? 'default' : type;
-                      assert_equals(response_text, expected,
-                                    'Service Worker should respond to fetch with the correct type');
-                    })
-                  .then(resolve);
-              });
-          });
-          return Promise.all(tests);
-        })
-      .then(function() {
-          frame.remove();
-          return service_worker_unregister_and_done(t, scope);
-        })
-      .catch(unreached_rejection(t));
-  }, 'Service Worker responds to fetch event with the correct cache types');
-
 </script>
 </body>
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-event-test-worker.js
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-event-test-worker.js
@@ -86,37 +86,32 @@ function handleFragmentCheck(event) {
   if (event.request.url.indexOf('#') === -1) {
     body = 'Fragment Not Found';
   } else {
     body = 'Fragment Found';
   }
   event.respondWith(new Response(body));
 }
 
-function handleCache(event) {
-  event.respondWith(new Response(event.request.cache));
-}
-
 self.addEventListener('fetch', function(event) {
     var url = event.request.url;
     var handlers = [
       { pattern: '?string', fn: handleString },
       { pattern: '?blob', fn: handleBlob },
       { pattern: '?referrerFull', fn: handleReferrerFull },
       { pattern: '?referrerPolicy', fn: handleReferrerPolicy },
       { pattern: '?referrer', fn: handleReferrer },
       { pattern: '?clientId', fn: handleClientId },
       { pattern: '?ignore', fn: function() {} },
       { pattern: '?null', fn: handleNullBody },
       { pattern: '?fetch', fn: handleFetch },
       { pattern: '?form-post', fn: handleFormPost },
       { pattern: '?multiple-respond-with', fn: handleMultipleRespondWith },
       { pattern: '?used-check', fn: handleUsedCheck },
-      { pattern: '?fragment-check', fn: handleFragmentCheck },
-      { pattern: '?cache', fn: handleCache },
+      { pattern: '?fragment-check', fn: handleFragmentCheck }
     ];
 
     var handler = null;
     for (var i = 0; i < handlers.length; ++i) {
       if (url.indexOf(handlers[i].pattern) != -1) {
         handler = handlers[i];
         break;
       }
deleted file mode 100644
--- a/testing/web-platform/tests/fetch/api/request/request-cache.html
+++ /dev/null
@@ -1,498 +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>
-  </head>
-  <body>
-    <script>
-    var now = new Date();
-    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 "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 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 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";
-      }
-      return "resources/cache.py?token=" + uuid +
-             "&content=" + content +
-             "&" + id + "=" + value +
-             "&expires=" + dates[info.state] +
-             vary + cache_control + ignore_request_headers;
-    }
-    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) {
-          return JSON.parse(text);
-        });
-    }
-    function populate_cache(url, content, info, type, identifier) {
-      var init = {cache: info.request_cache[0]};
-      if ("request_headers" in info) {
-        init.headers = info.request_headers[0];
-      }
-      return fetch(url, init)
-        .then(function(response) {
-          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 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 = [function() {
-          return populate_cache(url, content, info, type, identifier);
-        }];
-        for (var i = 1; 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];
-            }
-            return fetch(url, init)
-              .then(function(response) {
-                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));
-              });
-          });
-        }
-        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>
deleted file mode 100644
--- a/testing/web-platform/tests/fetch/api/request/resources/cache.py
+++ /dev/null
@@ -1,53 +0,0 @@
-def main(request, response):
-    token = request.GET.first("token", None)
-    if "querystate" in request.GET:
-        from json import JSONEncoder
-        response.headers.set("Content-Type", "text/plain")
-        return JSONEncoder().encode(request.server.stash.take(token))
-    content = request.GET.first("content", None)
-    tag = request.GET.first("tag", None)
-    date = request.GET.first("date", None)
-    expires = request.GET.first("expires", None)
-    vary = request.GET.first("vary", None)
-    cc = request.GET.first("cache_control", None)
-    inm = request.headers.get("If-None-Match", None)
-    ims = request.headers.get("If-Modified-Since", None)
-    pragma = request.headers.get("Pragma", None)
-    cache_control = request.headers.get("Cache-Control", None)
-    ignore = "ignore" in request.GET
-
-    server_state = request.server.stash.take(token)
-    if not server_state:
-        server_state = []
-    state = dict()
-    if not ignore:
-        if inm:
-            state["If-None-Match"] = inm
-        if ims:
-            state["If-Modified-Since"] = ims
-        if pragma:
-            state["Pragma"] = pragma
-        if cache_control:
-            state["Cache-Control"] = cache_control
-    server_state.append(state)
-    request.server.stash.put(token, server_state)
-
-    if tag:
-        response.headers.set("ETag", '"%s"' % tag)
-    elif date:
-        response.headers.set("Last-Modified", date)
-    if expires:
-        response.headers.set("Expires", expires)
-    if vary:
-        response.headers.set("Vary", vary)
-    if cc:
-        response.headers.set("Cache-Control", cc)
-
-    if ((inm is not None and inm == tag) or
-        (ims is not None and ims == date)):
-        response.status = (304, "Not Modified")
-        return ""
-    else:
-        response.status = (200, "OK")
-        response.headers.set("Content-Type", "text/plain")
-        return content