Index: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp |
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp |
index f63662243e6220bcbb6a5fd308f3ab3bcabc132b..d16ff0d63d1027e65119a5d636a74c703871a68d 100644 |
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp |
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp |
@@ -45,6 +45,8 @@ |
#include "core/html/parser/HTMLSrcsetParser.h" |
#include "core/html/parser/HTMLTokenizer.h" |
#include "core/loader/LinkLoader.h" |
+#include "platform/ContentType.h" |
+#include "platform/MIMETypeRegistry.h" |
#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/TraceEvent.h" |
#include "wtf/MainThread.h" |
@@ -116,6 +118,8 @@ public: |
StartTagScanner(const StringImpl* tagImpl, PassRefPtrWillBeRawPtr<MediaValues> mediaValues) |
: m_tagImpl(tagImpl) |
, m_linkIsStyleSheet(false) |
+ , m_linkHasType(false) |
+ , m_linkTypeIsSupportedStyleSheet(false) |
, m_linkIsPreconnect(false) |
, m_linkIsPreload(false) |
, m_linkIsImport(false) |
@@ -280,6 +284,9 @@ private: |
setCrossOrigin(attributeValue); |
} else if (match(attributeName, asAttr)) { |
m_asAttributeValue = attributeValue; |
+ } else if (match(attributeName, typeAttr)) { |
+ m_linkHasType = true; |
+ m_linkTypeIsSupportedStyleSheet = MIMETypeRegistry::isSupportedStyleSheetMIMEType(ContentType(attributeValue).type()); |
Yoav Weiss
2016/01/25 09:55:54
I don't think we need two booleans here. You could
suzyh_UTC10 (ex-contributor)
2016/01/27 00:07:53
Done.
|
} |
} |
@@ -392,6 +399,8 @@ private: |
return false; |
if (match(m_tagImpl, linkTag) && !m_linkIsStyleSheet && !m_linkIsImport && !m_linkIsPreload) |
return false; |
+ if (match(m_tagImpl, linkTag) && m_linkIsStyleSheet && m_linkHasType && !m_linkTypeIsSupportedStyleSheet) |
+ return false; |
if (match(m_tagImpl, inputTag) && !m_inputIsImage) |
return false; |
return true; |
@@ -416,6 +425,8 @@ private: |
ImageCandidate m_srcsetImageCandidate; |
String m_charset; |
bool m_linkIsStyleSheet; |
+ bool m_linkHasType; |
+ bool m_linkTypeIsSupportedStyleSheet; |
bool m_linkIsPreconnect; |
bool m_linkIsPreload; |
bool m_linkIsImport; |