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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp

Issue 1866433002: Use RequestContext to apply CSP in FrameFetchContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename redirectReceivedAndNotFollowed() to redirectBlocked() Created 4 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 unified diff | Download patch
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR equest, const WebURLResponse& passedRedirectResponse) 208 void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR equest, const WebURLResponse& passedRedirectResponse)
209 { 209 {
210 ASSERT(m_state != ConnectionStateReleased); 210 ASSERT(m_state != ConnectionStateReleased);
211 ASSERT(!passedNewRequest.isNull()); 211 ASSERT(!passedNewRequest.isNull());
212 ASSERT(!passedRedirectResponse.isNull()); 212 ASSERT(!passedRedirectResponse.isNull());
213 213
214 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); 214 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest());
215 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe sponse()); 215 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe sponse());
216 newRequest.setFollowedRedirect(true); 216 newRequest.setFollowedRedirect(true);
217 217
218 if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResp onse)) 218 if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResp onse)) {
219 m_resource->willFollowRedirect(newRequest, redirectResponse); 219 m_resource->willFollowRedirect(newRequest, redirectResponse);
220 else 220 } else {
221 m_resource->willNotFollowRedirect();
221 cancel(ResourceError::cancelledDueToAccessCheckError(newRequest.url())); 222 cancel(ResourceError::cancelledDueToAccessCheckError(newRequest.url()));
223 }
222 } 224 }
223 225
224 void ResourceLoader::didReceiveCachedMetadata(WebURLLoader*, const char* data, i nt length) 226 void ResourceLoader::didReceiveCachedMetadata(WebURLLoader*, const char* data, i nt length)
225 { 227 {
226 RELEASE_ASSERT(m_state == ConnectionStateReceivedResponse || m_state == Conn ectionStateReceivingData); 228 RELEASE_ASSERT(m_state == ConnectionStateReceivedResponse || m_state == Conn ectionStateReceivingData);
227 m_resource->setSerializedCachedMetadata(data, length); 229 m_resource->setSerializedCachedMetadata(data, length);
228 } 230 }
229 231
230 void ResourceLoader::didSendData(WebURLLoader*, unsigned long long bytesSent, un signed long long totalBytesToBeSent) 232 void ResourceLoader::didSendData(WebURLLoader*, unsigned long long bytesSent, un signed long long totalBytesToBeSent)
231 { 233 {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // empty buffer is a noop in most cases, but is destructive in the case of 411 // empty buffer is a noop in most cases, but is destructive in the case of
410 // a 304, where it will overwrite the cached data we should be reusing. 412 // a 304, where it will overwrite the cached data we should be reusing.
411 if (dataOut.size()) { 413 if (dataOut.size()) {
412 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength); 414 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength);
413 m_resource->setResourceBuffer(dataOut); 415 m_resource->setResourceBuffer(dataOut);
414 } 416 }
415 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); 417 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
416 } 418 }
417 419
418 } // namespace blink 420 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698