Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2616323002: CrossOriginAccessControl: separate access checks and error message generation (Closed)
Patch Set: initialize allowRedirect correctly Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 91bc63f6a9e6bec5c9d69e802d8613f5697c6988..b23dff7d18f08dbf625fc677e95bd4fa16b0ab30 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -444,24 +444,21 @@ AtomicString Resource::httpContentType() const {
}
bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const {
- String ignoredErrorDescription;
- return passesAccessControlCheck(securityOrigin, ignoredErrorDescription);
-}
+ StoredCredentials storedCredentials =
+ lastResourceRequest().allowStoredCredentials()
+ ? AllowStoredCredentials
+ : DoNotAllowStoredCredentials;
+ CrossOriginAccessControl::AccessStatus status =
+ CrossOriginAccessControl::checkAccess(m_response, storedCredentials,
+ securityOrigin);
-bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin,
- String& errorDescription) const {
- return blink::passesAccessControlCheck(
- m_response, lastResourceRequest().allowStoredCredentials()
- ? AllowStoredCredentials
- : DoNotAllowStoredCredentials,
- securityOrigin, errorDescription, lastResourceRequest().requestContext());
+ return status == CrossOriginAccessControl::kAccessAllowed;
}
bool Resource::isEligibleForIntegrityCheck(
SecurityOrigin* securityOrigin) const {
- String ignoredErrorDescription;
return securityOrigin->canRequest(resourceRequest().url()) ||
- passesAccessControlCheck(securityOrigin, ignoredErrorDescription);
+ passesAccessControlCheck(securityOrigin);
}
void Resource::setIntegrityDisposition(

Powered by Google App Engine