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

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

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed #38 Created 4 years, 3 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 static bool isManualRedirectFetchRequest(const ResourceRequest& request) 1089 static bool isManualRedirectFetchRequest(const ResourceRequest& request)
1090 { 1090 {
1091 return request.fetchRedirectMode() == WebURLRequest::FetchRedirectModeManual && request.requestContext() == WebURLRequest::RequestContextFetch; 1091 return request.fetchRedirectMode() == WebURLRequest::FetchRedirectModeManual && request.requestContext() == WebURLRequest::RequestContextFetch;
1092 } 1092 }
1093 1093
1094 bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& ne wRequest, const ResourceResponse& redirectResponse, int64_t encodedDataLength) 1094 bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& ne wRequest, const ResourceResponse& redirectResponse, int64_t encodedDataLength)
1095 { 1095 {
1096 if (!isManualRedirectFetchRequest(resource->resourceRequest())) { 1096 if (!isManualRedirectFetchRequest(resource->resourceRequest())) {
1097 if (!context().canRequest(resource->getType(), newRequest, newRequest.ur l(), resource->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultO riginRestrictionForType)) 1097 if (!context().canRequest(resource->getType(), newRequest, newRequest.ur l(), resource->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultO riginRestrictionForType))
1098 return false; 1098 return false;
1099
Nate Chapin 2016/09/14 22:25:27 This file only has whitespace changes?
tyoshino (SeeGerritForStatus) 2016/09/16 07:19:58 Oh, right. Reverted.
1099 if (resource->options().corsEnabled == IsCORSEnabled) { 1100 if (resource->options().corsEnabled == IsCORSEnabled) {
1100 RefPtr<SecurityOrigin> sourceOrigin = resource->options().securityOr igin; 1101 RefPtr<SecurityOrigin> sourceOrigin = resource->options().securityOr igin;
1101 if (!sourceOrigin.get()) 1102 if (!sourceOrigin.get())
1102 sourceOrigin = context().getSecurityOrigin(); 1103 sourceOrigin = context().getSecurityOrigin();
1103 1104
1104 String errorMessage; 1105 String errorMessage;
1105 StoredCredentials withCredentials = resource->lastResourceRequest(). allowStoredCredentials() ? AllowStoredCredentials : DoNotAllowStoredCredentials; 1106 StoredCredentials withCredentials = resource->lastResourceRequest(). allowStoredCredentials() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
1106 if (!CrossOriginAccessControl::handleRedirect(sourceOrigin, newReque st, redirectResponse, withCredentials, resource->mutableOptions(), errorMessage) ) { 1107 if (!CrossOriginAccessControl::handleRedirect(sourceOrigin, newReque st, redirectResponse, withCredentials, resource->mutableOptions(), errorMessage) ) {
1107 resource->setCORSFailed(); 1108 resource->setCORSFailed();
1108 context().addConsoleMessage(errorMessage); 1109 context().addConsoleMessage(errorMessage);
1109 return false; 1110 return false;
1110 } 1111 }
1111 } 1112 }
1113
1112 if (resource->getType() == Resource::Image && shouldDeferImageLoad(newRe quest.url())) 1114 if (resource->getType() == Resource::Image && shouldDeferImageLoad(newRe quest.url()))
1113 return false; 1115 return false;
1114 } 1116 }
1115 1117
1116 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource); 1118 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource);
1117 if (it != m_resourceTimingInfoMap.end()) { 1119 if (it != m_resourceTimingInfoMap.end()) {
1118 RefPtr<SecurityOrigin> originalSecurityOrigin = SecurityOrigin::create(r edirectResponse.url()); 1120 RefPtr<SecurityOrigin> originalSecurityOrigin = SecurityOrigin::create(r edirectResponse.url());
1119 RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create (newRequest.url()); 1121 RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create (newRequest.url());
1120 bool crossOrigin = !redirectedSecurityOrigin->isSameSchemeHostPort(origi nalSecurityOrigin.get()); 1122 bool crossOrigin = !redirectedSecurityOrigin->isSameSchemeHostPort(origi nalSecurityOrigin.get());
1121 it->value->addRedirect(redirectResponse, encodedDataLength, crossOrigin) ; 1123 it->value->addRedirect(redirectResponse, encodedDataLength, crossOrigin) ;
1122 } 1124 }
1125
1123 newRequest.setAllowStoredCredentials(resource->options().allowCredentials == AllowStoredCredentials); 1126 newRequest.setAllowStoredCredentials(resource->options().allowCredentials == AllowStoredCredentials);
1127
1124 willSendRequest(resource->identifier(), newRequest, redirectResponse, resour ce->options()); 1128 willSendRequest(resource->identifier(), newRequest, redirectResponse, resour ce->options());
1129
1125 return true; 1130 return true;
1126 } 1131 }
1127 1132
1128 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& newRequest, const ResourceResponse& redirectResponse, const ResourceLoaderOptio ns& options) 1133 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& newRequest, const ResourceResponse& redirectResponse, const ResourceLoaderOptio ns& options)
1129 { 1134 {
1130 context().dispatchWillSendRequest(identifier, newRequest, redirectResponse, options.initiatorInfo); 1135 context().dispatchWillSendRequest(identifier, newRequest, redirectResponse, options.initiatorInfo);
1131 } 1136 }
1132 1137
1133 void ResourceFetcher::updateAllImageResourcePriorities() 1138 void ResourceFetcher::updateAllImageResourcePriorities()
1134 { 1139 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 visitor->trace(m_context); 1328 visitor->trace(m_context);
1324 visitor->trace(m_archive); 1329 visitor->trace(m_archive);
1325 visitor->trace(m_loaders); 1330 visitor->trace(m_loaders);
1326 visitor->trace(m_nonBlockingLoaders); 1331 visitor->trace(m_nonBlockingLoaders);
1327 visitor->trace(m_documentResources); 1332 visitor->trace(m_documentResources);
1328 visitor->trace(m_preloads); 1333 visitor->trace(m_preloads);
1329 visitor->trace(m_resourceTimingInfoMap); 1334 visitor->trace(m_resourceTimingInfoMap);
1330 } 1335 }
1331 1336
1332 } // namespace blink 1337 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698