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

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

Issue 2276453002: Print the source origin rather than the origin of the target on CORS check failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted accidental expectation change 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/video-poster-cross-origin-crash2-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (sourceOrigin->canRequestNoSuborigin(response.url())) 246 if (sourceOrigin->canRequestNoSuborigin(response.url()))
247 return true; 247 return true;
248 248
249 // Use the original response instead of the 304 response for a successful re valdiation. 249 // Use the original response instead of the 304 response for a successful re valdiation.
250 const ResourceResponse& responseForAccessControl = (resource->isCacheValidat or() && response.httpStatusCode() == 304) ? resource->response() : response; 250 const ResourceResponse& responseForAccessControl = (resource->isCacheValidat or() && response.httpStatusCode() == 304) ? resource->response() : response;
251 String errorDescription; 251 String errorDescription;
252 if (!passesAccessControlCheck(responseForAccessControl, resource->options(). allowCredentials, sourceOrigin, errorDescription, resource->lastResourceRequest( ).requestContext())) { 252 if (!passesAccessControlCheck(responseForAccessControl, resource->options(). allowCredentials, sourceOrigin, errorDescription, resource->lastResourceRequest( ).requestContext())) {
253 resource->setCORSFailed(); 253 resource->setCORSFailed();
254 if (!forPreload) { 254 if (!forPreload) {
255 String resourceType = Resource::resourceTypeToString(resource->getTy pe(), resource->options().initiatorInfo); 255 String resourceType = Resource::resourceTypeToString(resource->getTy pe(), resource->options().initiatorInfo);
256 context().addConsoleMessage("Access to " + resourceType + " at '" + response.url().getString() + "' from origin '" + SecurityOrigin::create(response .url())->toString() + "' has been blocked by CORS policy: " + errorDescription); 256 context().addConsoleMessage("Access to " + resourceType + " at '" + response.url().getString() + "' from origin '" + sourceOrigin->toString() + "' h as been blocked by CORS policy: " + errorDescription);
257 } 257 }
258 return false; 258 return false;
259 } 259 }
260 return true; 260 return true;
261 } 261 }
262 262
263 bool ResourceFetcher::isControlledByServiceWorker() const 263 bool ResourceFetcher::isControlledByServiceWorker() const
264 { 264 {
265 return context().isControlledByServiceWorker(); 265 return context().isControlledByServiceWorker();
266 } 266 }
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 visitor->trace(m_context); 1323 visitor->trace(m_context);
1324 visitor->trace(m_archive); 1324 visitor->trace(m_archive);
1325 visitor->trace(m_loaders); 1325 visitor->trace(m_loaders);
1326 visitor->trace(m_nonBlockingLoaders); 1326 visitor->trace(m_nonBlockingLoaders);
1327 visitor->trace(m_documentResources); 1327 visitor->trace(m_documentResources);
1328 visitor->trace(m_preloads); 1328 visitor->trace(m_preloads);
1329 visitor->trace(m_resourceTimingInfoMap); 1329 visitor->trace(m_resourceTimingInfoMap);
1330 } 1330 }
1331 1331
1332 } // namespace blink 1332 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/video-poster-cross-origin-crash2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698