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

Unified Diff: Source/core/html/HTMLLinkElement.cpp

Issue 954233003: Enable SRI only for same origin and CORS content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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: Source/core/html/HTMLLinkElement.cpp
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index 56a52ca82f040342dc4ddb626f679584186614c5..0e273a80602009634b1723ffdd4b18552651c107 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -509,11 +509,15 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const
return;
}
- if (!SubresourceIntegrity::CheckSubresourceIntegrity(*m_owner, cachedStyleSheet->sheetText(), KURL(KURL(), href), cachedStyleSheet->mimeType())) {
- m_loading = false;
- removePendingSheet();
- notifyLoadedSheetAndAllCriticalSubresources(true);
- return;
+ if (cachedStyleSheet->isCORSNeededAndFailed() && m_owner->fastHasAttribute(HTMLNames::integrityAttr)) {
+ document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Cannot enforce integrity on non-CORS enabled resource."));
Mike West 2015/02/26 08:44:53 Same question as I had with script: should we just
jww 2015/03/06 02:16:42 Agreed as per my response in ScriptLoader.cpp. Fix
+ } else {
+ if (!SubresourceIntegrity::CheckSubresourceIntegrity(*m_owner, cachedStyleSheet->sheetText(), KURL(KURL(), href), cachedStyleSheet->mimeType())) {
+ m_loading = false;
+ removePendingSheet();
+ notifyLoadedSheetAndAllCriticalSubresources(true);
+ return;
+ }
}
// Completing the sheet load may cause scripts to execute.
« Source/core/fetch/ResourceLoader.cpp ('K') | « Source/core/fetch/ResourceLoaderHost.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698