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

Unified Diff: third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp

Issue 2723793002: De-Element ScriptLoader (Closed)
Patch Set: ScriptLoaderClient->ScriptElementBase, pure virtual interface, add fixme Created 3 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
Index: third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp
diff --git a/third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp b/third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp
index a0d9454923b756e49da00a226ac225c966616227..afc8bea53c8702abece78c2f45294e19c2a18896 100644
--- a/third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp
+++ b/third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp
@@ -101,37 +101,35 @@ HashAlgorithm SubresourceIntegrity::getPrioritizedHashFunction(
return algorithm2;
}
-bool SubresourceIntegrity::CheckSubresourceIntegrity(const Element& element,
- const char* content,
- size_t size,
- const KURL& resourceUrl,
- const Resource& resource) {
- Document& document = element.document();
- String attribute = element.fastGetAttribute(HTMLNames::integrityAttr);
- if (attribute.isEmpty())
+bool SubresourceIntegrity::CheckSubresourceIntegrity(
+ const String& integrityAttribute,
+ Document& document,
+ const char* content,
+ size_t size,
+ const KURL& resourceUrl,
+ const Resource& resource) {
+ if (integrityAttribute.isEmpty())
return true;
IntegrityMetadataSet metadataSet;
IntegrityParseResult integrityParseResult =
- parseIntegrityAttribute(attribute, metadataSet, &document);
+ parseIntegrityAttribute(integrityAttribute, metadataSet, &document);
// On failed parsing, there's no need to log an error here, as
// parseIntegrityAttribute() will output an appropriate console message.
if (integrityParseResult != IntegrityParseValidResult)
return true;
- return CheckSubresourceIntegrity(metadataSet, element, content, size,
+ return CheckSubresourceIntegrity(metadataSet, document, content, size,
resourceUrl, resource);
}
bool SubresourceIntegrity::CheckSubresourceIntegrity(
const IntegrityMetadataSet& metadataSet,
- const Element& element,
+ Document& document,
const char* content,
size_t size,
const KURL& resourceUrl,
const Resource& resource) {
- Document& document = element.document();
-
if (!resource.isEligibleForIntegrityCheck(document.getSecurityOrigin())) {
UseCounter::count(document,
UseCounter::SRIElementIntegrityAttributeButIneligible);

Powered by Google App Engine
This is Rietveld 408576698