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

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

Issue 1196423003: Improve console log message for CORS failure (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Created 4 years, 4 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (sourceOrigin->canRequestNoSuborigin(response.url())) 253 if (sourceOrigin->canRequestNoSuborigin(response.url()))
254 return true; 254 return true;
255 255
256 // Use the original response instead of the 304 response for a successful re valdiation. 256 // Use the original response instead of the 304 response for a successful re valdiation.
257 const ResourceResponse& responseForAccessControl = (resource->isCacheValidat or() && response.httpStatusCode() == 304) ? resource->response() : response; 257 const ResourceResponse& responseForAccessControl = (resource->isCacheValidat or() && response.httpStatusCode() == 304) ? resource->response() : response;
258 String errorDescription; 258 String errorDescription;
259 if (!passesAccessControlCheck(responseForAccessControl, resource->options(). allowCredentials, sourceOrigin, errorDescription, resource->lastResourceRequest( ).requestContext())) { 259 if (!passesAccessControlCheck(responseForAccessControl, resource->options(). allowCredentials, sourceOrigin, errorDescription, resource->lastResourceRequest( ).requestContext())) {
260 resource->setCORSFailed(); 260 resource->setCORSFailed();
261 if (!forPreload) { 261 if (!forPreload) {
262 String resourceType = Resource::resourceTypeToString(resource->getTy pe(), resource->options().initiatorInfo); 262 String resourceType = Resource::resourceTypeToString(resource->getTy pe(), resource->options().initiatorInfo);
263 context().addConsoleMessage(resourceType + " from origin '" + Securi tyOrigin::create(response.url())->toString() + "' has been blocked from loading by Cross-Origin Resource Sharing policy: " + errorDescription); 263 context().addConsoleMessage("Access to " + resourceType + " at '" + response.url().getString() + "' from origin '" + SecurityOrigin::create(response .url())->toString() + "' has been blocked by CORS policy: " + errorDescription);
264 } 264 }
265 return false; 265 return false;
266 } 266 }
267 return true; 267 return true;
268 } 268 }
269 269
270 bool ResourceFetcher::isControlledByServiceWorker() const 270 bool ResourceFetcher::isControlledByServiceWorker() const
271 { 271 {
272 return context().isControlledByServiceWorker(); 272 return context().isControlledByServiceWorker();
273 } 273 }
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 visitor->trace(m_context); 1301 visitor->trace(m_context);
1302 visitor->trace(m_archive); 1302 visitor->trace(m_archive);
1303 visitor->trace(m_loaders); 1303 visitor->trace(m_loaders);
1304 visitor->trace(m_nonBlockingLoaders); 1304 visitor->trace(m_nonBlockingLoaders);
1305 visitor->trace(m_documentResources); 1305 visitor->trace(m_documentResources);
1306 visitor->trace(m_preloads); 1306 visitor->trace(m_preloads);
1307 visitor->trace(m_resourceTimingInfoMap); 1307 visitor->trace(m_resourceTimingInfoMap);
1308 } 1308 }
1309 1309
1310 } // namespace blink 1310 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698