Index: Source/core/html/HTMLLinkElement.cpp |
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp |
index 725217d564185e6dce1e2d0ebecd2a23a2d44b73..93bc16b9007e9dd898acf7c74176ffd66054762e 100644 |
--- a/Source/core/html/HTMLLinkElement.cpp |
+++ b/Source/core/html/HTMLLinkElement.cpp |
@@ -42,6 +42,7 @@ |
#include "core/fetch/ResourceFetcher.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
+#include "core/frame/SubresourceIntegrity.h" |
#include "core/frame/csp/ContentSecurityPolicy.h" |
#include "core/html/LinkManifest.h" |
#include "core/html/imports/LinkImport.h" |
@@ -501,8 +502,14 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
if (!m_owner->inDocument()) { |
ASSERT(!m_sheet); |
return; |
+ } |
+ if (!SubresourceIntegrity::CheckSubresourceIntegrity(*m_owner, cachedStyleSheet->sheetText(), KURL(KURL(), href))) { |
+ m_loading = false; |
+ removePendingSheet(); |
+ return; |
} |
+ |
// Completing the sheet load may cause scripts to execute. |
RefPtrWillBeRawPtr<Node> protector(m_owner.get()); |
@@ -527,6 +534,7 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
if (m_sheet) |
clearSheet(); |
+ |
m_sheet = CSSStyleSheet::create(styleSheet, m_owner); |
m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
m_sheet->setTitle(m_owner->title()); |