Chromium Code Reviews| Index: Source/core/frame/SubresourceIntegrity.cpp |
| diff --git a/Source/core/frame/SubresourceIntegrity.cpp b/Source/core/frame/SubresourceIntegrity.cpp |
| index 4377bcb82f6deee5da1334c19c3ba02cc7c3a634..f53242686c32193e3f56bdc6094eb413b6bd1295 100644 |
| --- a/Source/core/frame/SubresourceIntegrity.cpp |
| +++ b/Source/core/frame/SubresourceIntegrity.cpp |
| @@ -114,8 +114,16 @@ bool SubresourceIntegrity::CheckSubresourceIntegrity(const Element& element, con |
| return false; |
| } |
| + String errorMessage; |
| + bool result = CheckSubresourceIntegrity(attribute, source, resourceUrl, document, errorMessage); |
| + logErrorToConsole(errorMessage, document); |
|
sof
2015/08/20 20:29:29
Don't you need to consider 'result' before logging
jww
2015/08/20 23:16:44
Yes, fantastic catch. Thanks, and fixed.
|
| + return result; |
| +} |
| + |
| +bool SubresourceIntegrity::CheckSubresourceIntegrity(const String& integrityMetadata, const WTF::String& source, const KURL& resourceUrl, Document& document, String& errorMessage) |
| +{ |
| WTF::Vector<IntegrityMetadata> metadataList; |
| - IntegrityParseResult integrityParseResult = parseIntegrityAttribute(attribute, metadataList, document); |
| + IntegrityParseResult integrityParseResult = parseIntegrityAttribute(integrityMetadata, metadataList, document); |
| // On failed parsing, there's no need to log an error here, as |
| // parseIntegrityAttribute() will output an appropriate console message. |
| if (integrityParseResult != IntegrityParseValidResult) |
| @@ -158,9 +166,9 @@ bool SubresourceIntegrity::CheckSubresourceIntegrity(const Element& element, con |
| // need to be very careful not to expose this in exceptions or |
| // JavaScript, otherwise it risks exposing information about the |
| // resource cross-origin. |
| - logErrorToConsole("Failed to find a valid digest in the 'integrity' attribute for resource '" + resourceUrl.elidedString() + "' with computed SHA-256 integrity '" + digestToString(digest) + "'. The resource has been blocked.", document); |
| + errorMessage = "Failed to find a valid digest in the 'integrity' attribute for resource '" + resourceUrl.elidedString() + "' with computed SHA-256 integrity '" + digestToString(digest) + "'. The resource has been blocked."; |
| } else { |
| - logErrorToConsole("There was an error computing an integrity value for resource '" + resourceUrl.elidedString() + "'. The resource has been blocked.", document); |
| + errorMessage = "There was an error computing an integrity value for resource '" + resourceUrl.elidedString() + "'. The resource has been blocked."; |
| } |
| UseCounter::count(document, UseCounter::SRIElementWithNonMatchingIntegrityAttribute); |
| return false; |