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

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

Issue 1501393003: Deprecate fetching stylesheets with unsupported type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
Index: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
index 521b2ad779c311c6413ca9e8e061e94b3d777dfe..01508aac618e589b98a4a29c9b8474699b34d2dc 100644
--- a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
@@ -51,6 +51,8 @@
#include "core/loader/FrameLoaderClient.h"
#include "core/loader/NetworkHintsInterface.h"
#include "core/style/StyleInheritedData.h"
+#include "platform/ContentType.h"
+#include "platform/MIMETypeRegistry.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "public/platform/Platform.h"
#include "wtf/StdLibExtras.h"
@@ -126,6 +128,12 @@ static LinkEventSender& linkLoadEventSender()
return *sharedLoadEventSender;
}
+static bool styleSheetTypeIsSupported(const String& type)
+{
+ String trimmedType = ContentType(type).type();
+ return trimmedType.isEmpty() || MIMETypeRegistry::isSupportedStyleSheetMIMEType(trimmedType);
+}
+
void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector<IntSize>& iconSizes)
{
ASSERT(iconSizes.isEmpty());
@@ -713,6 +721,8 @@ void LinkStyle::process()
return;
if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && shouldLoadResource() && builder.url().isValid()) {
+ if (!styleSheetTypeIsSupported(type))
+ UseCounter::countDeprecation(document(), UseCounter::NonCSSStyleSheetType);
if (resource()) {
removePendingSheet();
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.cpp ('k') | third_party/WebKit/Source/platform/MIMETypeRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698