Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // Fail as cache miss if cached response is a redirect. | 158 // Fail as cache miss if cached response is a redirect. |
| 159 HandleError( | 159 HandleError( |
| 160 ResourceError::CacheMissError(resource_->LastResourceRequest().Url())); | 160 ResourceError::CacheMissError(resource_->LastResourceRequest().Url())); |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 ResourceRequest& new_request(passed_new_request.ToMutableResourceRequest()); | 164 ResourceRequest& new_request(passed_new_request.ToMutableResourceRequest()); |
| 165 const ResourceResponse& redirect_response( | 165 const ResourceResponse& redirect_response( |
| 166 passed_redirect_response.ToResourceResponse()); | 166 passed_redirect_response.ToResourceResponse()); |
| 167 | 167 |
| 168 // For main resources, we want to ensure that every step of the redirect chain | |
| 169 // is a valid transition, so set the SecurityOrigin based on the url of the | |
| 170 // redirect source. | |
| 171 if (resource_->GetType() == Resource::kMainResource) { | |
| 172 resource_->MutableOptions().security_origin = | |
| 173 SecurityOrigin::Create(redirect_response.Url()); | |
|
kinuko
2017/05/23 13:54:38
For DocumentLoader case I might prefer having this
Nate Chapin
2017/05/23 21:20:50
Moved back to DocumentLoader.
| |
| 174 } | |
| 175 | |
| 168 new_request.SetRedirectStatus( | 176 new_request.SetRedirectStatus( |
| 169 ResourceRequest::RedirectStatus::kFollowedRedirect); | 177 ResourceRequest::RedirectStatus::kFollowedRedirect); |
| 170 | 178 |
| 171 const KURL original_url = new_request.Url(); | 179 const KURL original_url = new_request.Url(); |
| 172 | 180 |
| 173 if (!IsManualRedirectFetchRequest(resource_->GetResourceRequest())) { | 181 if (!IsManualRedirectFetchRequest(resource_->GetResourceRequest())) { |
| 174 ResourceRequestBlockedReason blocked_reason = Context().CanFollowRedirect( | 182 ResourceRequestBlockedReason blocked_reason = Context().CanFollowRedirect( |
| 175 resource_->GetType(), new_request, new_request.Url(), | 183 resource_->GetType(), new_request, new_request.Url(), |
| 176 resource_->Options(), | 184 resource_->Options(), |
| 177 /* Don't send security violation reports for unused preloads */ | 185 /* Don't send security violation reports for unused preloads */ |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 return; | 535 return; |
| 528 | 536 |
| 529 // Don't activate if cache policy is explicitly set. | 537 // Don't activate if cache policy is explicitly set. |
| 530 if (request.GetCachePolicy() != WebCachePolicy::kUseProtocolCachePolicy) | 538 if (request.GetCachePolicy() != WebCachePolicy::kUseProtocolCachePolicy) |
| 531 return; | 539 return; |
| 532 | 540 |
| 533 is_cache_aware_loading_activated_ = true; | 541 is_cache_aware_loading_activated_ = true; |
| 534 } | 542 } |
| 535 | 543 |
| 536 } // namespace blink | 544 } // namespace blink |
| OLD | NEW |