| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); | 129 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool ResourceLoader::willFollowRedirect( | 132 bool ResourceLoader::willFollowRedirect( |
| 133 WebURLLoader*, | 133 WebURLLoader*, |
| 134 WebURLRequest& passedNewRequest, | 134 WebURLRequest& passedNewRequest, |
| 135 const WebURLResponse& passedRedirectResponse) { | 135 const WebURLResponse& passedRedirectResponse) { |
| 136 DCHECK(!passedNewRequest.isNull()); | 136 DCHECK(!passedNewRequest.isNull()); |
| 137 DCHECK(!passedRedirectResponse.isNull()); | 137 DCHECK(!passedRedirectResponse.isNull()); |
| 138 | 138 |
| 139 if (m_resource->resourceRequest().isCacheAwareLoadingActivated()) { |
| 140 // Fail as cache miss, then reload with original request in |
| 141 // ResourceFetcher::didFailLoading(). |
| 142 ResourceError error; |
| 143 error.setIsCacheMiss(true); |
| 144 didFail(nullptr, error); |
| 145 return false; |
| 146 } |
| 147 |
| 139 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); | 148 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); |
| 140 const ResourceResponse& redirectResponse( | 149 const ResourceResponse& redirectResponse( |
| 141 passedRedirectResponse.toResourceResponse()); | 150 passedRedirectResponse.toResourceResponse()); |
| 142 newRequest.setRedirectStatus( | 151 newRequest.setRedirectStatus( |
| 143 ResourceRequest::RedirectStatus::FollowedRedirect); | 152 ResourceRequest::RedirectStatus::FollowedRedirect); |
| 144 | 153 |
| 145 const KURL originalURL = newRequest.url(); | 154 const KURL originalURL = newRequest.url(); |
| 146 | 155 |
| 147 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, | 156 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, |
| 148 redirectResponse)) { | 157 redirectResponse)) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // a 304, where it will overwrite the cached data we should be reusing. | 267 // a 304, where it will overwrite the cached data we should be reusing. |
| 259 if (dataOut.size()) { | 268 if (dataOut.size()) { |
| 260 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), | 269 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), |
| 261 encodedDataLength); | 270 encodedDataLength); |
| 262 m_resource->setResourceBuffer(dataOut); | 271 m_resource->setResourceBuffer(dataOut); |
| 263 } | 272 } |
| 264 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 273 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 265 } | 274 } |
| 266 | 275 |
| 267 } // namespace blink | 276 } // namespace blink |
| OLD | NEW |