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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); | 130 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool ResourceLoader::willFollowRedirect( | 133 bool ResourceLoader::willFollowRedirect( |
| 134 WebURLLoader*, | 134 WebURLLoader*, |
| 135 WebURLRequest& passedNewRequest, | 135 WebURLRequest& passedNewRequest, |
| 136 const WebURLResponse& passedRedirectResponse) { | 136 const WebURLResponse& passedRedirectResponse) { |
| 137 DCHECK(!passedNewRequest.isNull()); | 137 DCHECK(!passedNewRequest.isNull()); |
| 138 DCHECK(!passedRedirectResponse.isNull()); | 138 DCHECK(!passedRedirectResponse.isNull()); |
| 139 | 139 |
| 140 if (m_resource->resourceRequest().isCacheAwareLoadingActivated()) { | |
| 141 // Fail as disk cache miss and retry in ResourceFetcher::didFailLoading(). | |
| 142 didFail(nullptr, WebURLError::cacheMissError()); | |
|
kinuko
2016/10/22 04:43:01
nit: I think we'd better create ResourceError here
Shao-Chuan Lee
2016/10/25 04:18:20
I've noticed that other places pass ResourceError
| |
| 143 return false; | |
| 144 } | |
| 145 | |
| 140 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); | 146 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); |
| 141 const ResourceResponse& redirectResponse( | 147 const ResourceResponse& redirectResponse( |
| 142 passedRedirectResponse.toResourceResponse()); | 148 passedRedirectResponse.toResourceResponse()); |
| 143 newRequest.setRedirectStatus( | 149 newRequest.setRedirectStatus( |
| 144 ResourceRequest::RedirectStatus::FollowedRedirect); | 150 ResourceRequest::RedirectStatus::FollowedRedirect); |
| 145 | 151 |
| 146 const KURL originalURL = newRequest.url(); | 152 const KURL originalURL = newRequest.url(); |
| 147 | 153 |
| 148 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, | 154 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, |
| 149 redirectResponse)) { | 155 redirectResponse)) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 // a 304, where it will overwrite the cached data we should be reusing. | 265 // a 304, where it will overwrite the cached data we should be reusing. |
| 260 if (dataOut.size()) { | 266 if (dataOut.size()) { |
| 261 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), | 267 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), |
| 262 encodedDataLength); | 268 encodedDataLength); |
| 263 m_resource->setResourceBuffer(dataOut); | 269 m_resource->setResourceBuffer(dataOut); |
| 264 } | 270 } |
| 265 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 271 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 266 } | 272 } |
| 267 | 273 |
| 268 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |