diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 995ed6188234..7b90bd23b895 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -332,6 +332,7 @@ FetchDriver::HttpFetch() // dom/workers/ServiceWorkerManager.cpp internalChan->SetCorsMode(static_cast(mRequest->Mode())); internalChan->SetRedirectMode(static_cast(mRequest->GetRedirectMode())); + internalChan->SetFetchCacheMode(static_cast(mRequest->GetCacheMode())); } // Step 5. Proxy authentication will be handled by Necko. diff --git a/dom/fetch/InternalRequest.h b/dom/fetch/InternalRequest.h index 7c07bf49cb01..018900d9ee58 100644 --- a/dom/fetch/InternalRequest.h +++ b/dom/fetch/InternalRequest.h @@ -117,6 +117,7 @@ public: InternalRequest(const nsACString& aURL, const nsACString& aMethod, already_AddRefed aHeaders, + RequestCache aCacheMode, RequestMode aMode, RequestRedirect aRequestRedirect, RequestCredentials aRequestCredentials, @@ -132,7 +133,7 @@ public: , mMode(aMode) , mCredentialsMode(aRequestCredentials) , mResponseTainting(LoadTainting::Basic) - , mCacheMode(RequestCache::Default) + , mCacheMode(aCacheMode) , mRedirectMode(aRequestRedirect) , mAuthenticationFlag(false) , mForceOriginHeader(false) diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/workers/ServiceWorkerPrivate.cpp index 35a17122c52d..b02a4229a036 100644 --- a/dom/workers/ServiceWorkerPrivate.cpp +++ b/dom/workers/ServiceWorkerPrivate.cpp @@ -990,6 +990,7 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable nsCString mMethod; nsString mClientId; bool mIsReload; + RequestCache mCacheMode; RequestMode mRequestMode; RequestRedirect mRequestRedirect; RequestCredentials mRequestCredentials; @@ -1013,6 +1014,7 @@ public: , 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 @@ -1110,11 +1112,16 @@ public: mRequestMode = InternalRequest::MapChannelToRequestMode(channel); - // This is safe due to static_asserts at top of file. + // This is safe due to static_asserts in ServiceWorkerManager.cpp. uint32_t redirectMode; internalChannel->GetRedirectMode(&redirectMode); mRequestRedirect = static_cast(redirectMode); + // This is safe due to static_asserts in ServiceWorkerManager.cpp. + uint32_t cacheMode; + internalChannel->GetFetchCacheMode(&cacheMode); + mCacheMode = static_cast(cacheMode); + mRequestCredentials = InternalRequest::MapChannelToRequestCredentials(channel); rv = httpChannel->VisitNonDefaultRequestHeaders(this); @@ -1206,6 +1213,7 @@ private: RefPtr internalReq = new InternalRequest(mSpec, mMethod, internalHeaders.forget(), + mCacheMode, mRequestMode, mRequestRedirect, mRequestCredentials,