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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 1623403002: Remove fetching stylesheets with unsupported type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cbd38279b563e33947908c6f0b0e49e239da1851 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,7 @@ public:
StartTagScanner(const StringImpl* tagImpl, PassRefPtrWillBeRawPtr<MediaValues> mediaValues)
: m_tagImpl(tagImpl)
, m_linkIsStyleSheet(false)
+ , m_linkTypeIsMissingOrSupportedStyleSheet(true)
, m_linkIsPreconnect(false)
, m_linkIsPreload(false)
, m_linkIsImport(false)
@@ -280,6 +283,8 @@ private:
setCrossOrigin(attributeValue);
} else if (match(attributeName, asAttr)) {
m_asAttributeValue = attributeValue;
+ } else if (match(attributeName, typeAttr)) {
+ m_linkTypeIsMissingOrSupportedStyleSheet = MIMETypeRegistry::isSupportedStyleSheetMIMEType(ContentType(attributeValue).type());
}
}
@@ -392,10 +397,13 @@ private:
return false;
if (match(m_tagImpl, linkTag) && !m_linkIsStyleSheet && !m_linkIsImport && !m_linkIsPreload)
return false;
+ if (match(m_tagImpl, linkTag) && m_linkIsStyleSheet && !m_linkTypeIsMissingOrSupportedStyleSheet)
+ return false;
if (match(m_tagImpl, inputTag) && !m_inputIsImage)
return false;
return true;
}
+
void setCrossOrigin(const String& corsSetting)
{
m_crossOrigin = crossOriginAttributeValue(corsSetting);
@@ -416,6 +424,7 @@ private:
ImageCandidate m_srcsetImageCandidate;
String m_charset;
bool m_linkIsStyleSheet;
+ bool m_linkTypeIsMissingOrSupportedStyleSheet;
bool m_linkIsPreconnect;
bool m_linkIsPreload;
bool m_linkIsImport;
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698