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

Unified Diff: Source/core/loader/DocumentThreadableLoader.cpp

Issue 1243353002: Skip the Service Worker CORS fallback for same origin requests. [1/2 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add link to crbug.com/336894 Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index 8b84b7147cada891d7ace3393be6bb007a543489..74bf523ccfafd5dd70bdf8d83fee6171c90a7c4e 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -452,7 +452,17 @@ void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
return;
}
- ASSERT(!m_fallbackRequestForServiceWorker);
+ // Even if the request met the conditions to get handled by a Service Worker
+ // in the constructor of this class (and therefore
+ // |m_fallbackRequestForServiceWorker| is set), the Service Worker may skip
+ // processing the request. Only if the request is same origin, the skipped
+ // response may come here (wasFetchedViaServiceWorker() returns false) since
+ // such a request doesn't have to go through the CORS algorithm by calling
+ // loadFallbackRequestForServiceWorker().
+ // FIXME: We should use |m_sameOriginRequest| when we will support
+ // Suborigins (crbug.com/336894) for Service Worker.
+ ASSERT(!m_fallbackRequestForServiceWorker || securityOrigin()->canRequest(m_fallbackRequestForServiceWorker->url()));
tyoshino (SeeGerritForStatus) 2015/07/23 05:33:16 have you investigated carefully that this is consi
horo 2015/07/23 07:59:44 I don't think these conditions (in blink and conte
tyoshino (SeeGerritForStatus) 2015/07/23 08:09:42 Ah, yeah, actually it's enough that condition hold
horo 2015/07/23 09:42:00 The document which origin is an unique origin can'
tyoshino (SeeGerritForStatus) 2015/07/23 09:50:13 Thanks. Please write that in the CL description.
+ m_fallbackRequestForServiceWorker = nullptr;
if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessControl) {
String accessControlErrorDescription;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698