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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchManager.cpp

Issue 2785123002: Make no-location redirect response to be "opaque redirect" when redirect mode is manual. (Closed)
Patch Set: add link to crbug.com/707185 Created 3 years, 8 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/navigation-redirect-scope1.php ('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/modules/fetch/FetchManager.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
index 3fa17aa081f9285414a8d8cbe76459b6b86218c0..6e415324d38b1336a661443afb9436f33c4a32f1 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
@@ -450,26 +450,14 @@ void FetchManager::Loader::DidReceiveResponse(
FetchResponseData* tainted_response = nullptr;
- if (NetworkUtils::IsRedirectResponseCode(response_http_status_code_)) {
- Vector<String> locations;
- response_data->HeaderList()->GetAll(HTTPNames::Location, locations);
- if (locations.size() > 1) {
- PerformNetworkError("Multiple Location header.");
- return;
- }
- if (locations.size() == 1) {
- KURL location_url(request_->Url(), locations[0]);
- if (!location_url.IsValid()) {
- PerformNetworkError("Invalid Location header.");
- return;
- }
- ASSERT(request_->Redirect() == WebURLRequest::kFetchRedirectModeManual);
- tainted_response = response_data->CreateOpaqueRedirectFilteredResponse();
- }
- // When the location header doesn't exist, we don't treat the response
- // as a redirect response, and execute tainting.
- }
- if (!tainted_response) {
+ DCHECK(!(NetworkUtils::IsRedirectResponseCode(response_http_status_code_) &&
+ response_data->HeaderList()->Has(HTTPNames::Location) &&
+ request_->Redirect() != WebURLRequest::kFetchRedirectModeManual));
+
+ if (NetworkUtils::IsRedirectResponseCode(response_http_status_code_) &&
+ request_->Redirect() == WebURLRequest::kFetchRedirectModeManual) {
+ tainted_response = response_data->CreateOpaqueRedirectFilteredResponse();
+ } else {
switch (tainting) {
case FetchRequestData::kBasicTainting:
tainted_response = response_data->CreateBasicFilteredResponse();
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/navigation-redirect-scope1.php ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698