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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 { | 116 { |
| 117 if (m_loader) | 117 if (m_loader) |
| 118 m_loader->didChangePriority(static_cast<WebURLRequest::Priority>(loadPri ority), intraPriorityValue); | 118 m_loader->didChangePriority(static_cast<WebURLRequest::Priority>(loadPri ority), intraPriorityValue); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ResourceLoader::cancel() | 121 void ResourceLoader::cancel() |
| 122 { | 122 { |
| 123 didFail(nullptr, ResourceError::cancelledError(m_resource->lastResourceReque st().url())); | 123 didFail(nullptr, ResourceError::cancelledError(m_resource->lastResourceReque st().url())); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR equest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength) | 126 bool ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR equest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength) |
| 127 { | 127 { |
| 128 ASSERT(!passedNewRequest.isNull()); | 128 ASSERT(!passedNewRequest.isNull()); |
| 129 ASSERT(!passedRedirectResponse.isNull()); | 129 ASSERT(!passedRedirectResponse.isNull()); |
| 130 | 130 |
| 131 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); | 131 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); |
| 132 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe sponse()); | 132 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe sponse()); |
| 133 newRequest.setRedirectStatus(ResourceRequest::RedirectStatus::FollowedRedire ct); | 133 newRequest.setRedirectStatus(ResourceRequest::RedirectStatus::FollowedRedire ct); |
| 134 | 134 |
| 135 const KURL originalURL = newRequest.url(); | |
| 135 if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResp onse, encodedDataLength)) { | 136 if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResp onse, encodedDataLength)) { |
| 136 m_resource->willFollowRedirect(newRequest, redirectResponse); | 137 if (m_resource->willFollowRedirect(newRequest, redirectResponse)) |
| 138 return newRequest.url() == originalURL; | |
|
Nate Chapin
2016/09/06 16:46:14
I assume this is handling some old cases that stil
tyoshino (SeeGerritForStatus)
2016/09/07 10:52:28
Inside m_fetcher->willFollowRedirect(), we may rea
| |
| 139 | |
| 140 return false; | |
| 137 } else { | 141 } else { |
| 138 m_resource->willNotFollowRedirect(); | 142 m_resource->willNotFollowRedirect(); |
| 139 if (m_loader) | 143 if (m_loader) |
| 140 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newRe quest.url())); | 144 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newRe quest.url())); |
|
Nate Chapin
2016/09/06 16:46:14
Is the didFail() still needed?
tyoshino (SeeGerritForStatus)
2016/09/07 10:52:28
Hmm, ResourceDispatcher::Cancel() will be invoked
Nate Chapin
2016/09/07 17:05:45
No. I guess ResourceDispatcher::Cancel() could tri
tyoshino (SeeGerritForStatus)
2016/09/14 14:53:47
OK. I'll try to do it later when I get chance.
| |
| 145 return false; | |
| 141 } | 146 } |
| 142 } | 147 } |
| 143 | 148 |
| 144 void ResourceLoader::didReceiveCachedMetadata(WebURLLoader*, const char* data, i nt length) | 149 void ResourceLoader::didReceiveCachedMetadata(WebURLLoader*, const char* data, i nt length) |
| 145 { | 150 { |
| 146 m_resource->setSerializedCachedMetadata(data, length); | 151 m_resource->setSerializedCachedMetadata(data, length); |
| 147 } | 152 } |
| 148 | 153 |
| 149 void ResourceLoader::didSendData(WebURLLoader*, unsigned long long bytesSent, un signed long long totalBytesToBeSent) | 154 void ResourceLoader::didSendData(WebURLLoader*, unsigned long long bytesSent, un signed long long totalBytesToBeSent) |
| 150 { | 155 { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 // empty buffer is a noop in most cases, but is destructive in the case of | 225 // empty buffer is a noop in most cases, but is destructive in the case of |
| 221 // a 304, where it will overwrite the cached data we should be reusing. | 226 // a 304, where it will overwrite the cached data we should be reusing. |
| 222 if (dataOut.size()) { | 227 if (dataOut.size()) { |
| 223 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength); | 228 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength); |
| 224 m_resource->setResourceBuffer(dataOut); | 229 m_resource->setResourceBuffer(dataOut); |
| 225 } | 230 } |
| 226 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 231 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 227 } | 232 } |
| 228 | 233 |
| 229 } // namespace blink | 234 } // namespace blink |
| OLD | NEW |