Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2177283006: Do not reuse opaque Resource from a service worker for non no-cors requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests, reflect comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-worker.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 76f39f123ad988d54669e81eef06fcd2ebab40cb..d9af3c27c09be85649dd4c1612af808c850edd18 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -696,6 +696,11 @@ ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy
if (request.downloadToFile() || request.useStreamOnResponse())
return Reload;
+ // Never reuse opaque responses from a service worker for requests that
+ // are not no-cors. https://crbug.com/625575
+ if (existingResource->response().wasFetchedViaServiceWorker() && existingResource->response().serviceWorkerResponseType() == WebServiceWorkerResponseTypeOpaque && request.fetchRequestMode() != WebURLRequest::FetchRequestModeNoCORS)
+ return Reload;
+
// If resource was populated from a SubstituteData load or data: url, use it.
if (isStaticData)
return Use;
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698