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

Unified Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 984213002: CORS errors print error twice on preload. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added delay to cors-script.php Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/security/resources/cors-script.php ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index 689d8f481624f4b1bb1f63787e7336bf613a2381..26c9e5b6852c21f03b562d078ff8137e45cf51d4 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -585,7 +585,8 @@ bool ResourceFetcher::canRequest(Resource::Type type, const ResourceRequest& res
bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sourceOrigin, const KURL& url) const
{
// Redirects can change the response URL different from one of request.
- if (!canRequest(resource->type(), resource->resourceRequest(), url, resource->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrictionForType))
+ bool forPreload = resource->isUnusedPreload();
+ if (!canRequest(resource->type(), resource->resourceRequest(), url, resource->options(), forPreload, FetchRequest::UseDefaultOriginRestrictionForType))
return false;
if (!sourceOrigin && document())
@@ -598,7 +599,7 @@ bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
if (!resource->passesAccessControlCheck(document(), sourceOrigin, errorDescription)) {
if (resource->type() == Resource::Font)
toFontResource(resource)->setCORSFailed();
- if (frame() && frame()->document()) {
+ if (!forPreload && frame() && frame()->document()) {
String resourceType = Resource::resourceTypeToString(resource->type(), resource->options().initiatorInfo);
frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, resourceType + " from origin '" + SecurityOrigin::create(url)->toString() + "' has been blocked from loading by Cross-Origin Resource Sharing policy: " + errorDescription));
}
« no previous file with comments | « LayoutTests/http/tests/security/resources/cors-script.php ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698