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

Side by Side 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: Updated tests, converted from fix to deprecation warning 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 iconSizes.append(IntSize(width, height)); 119 iconSizes.append(IntSize(width, height));
120 } 120 }
121 } 121 }
122 122
123 static LinkEventSender& linkLoadEventSender() 123 static LinkEventSender& linkLoadEventSender()
124 { 124 {
125 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<LinkEventSender>, sharedLoadEvent Sender, (LinkEventSender::create(EventTypeNames::load))); 125 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<LinkEventSender>, sharedLoadEvent Sender, (LinkEventSender::create(EventTypeNames::load)));
126 return *sharedLoadEventSender; 126 return *sharedLoadEventSender;
127 } 127 }
128 128
129 static bool styleSheetTypeIsSupported(const String& type)
130 {
131 return type.isEmpty() || type.contains("text/css");
Yoav Weiss 2016/01/18 08:21:18 This should be a case agnostic comparison, and sho
suzyh_UTC10 (ex-contributor) 2016/01/19 01:58:12 I've plumbed it through platform/MimeTypeRegistry
132 }
133
129 void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector<IntS ize>& iconSizes) 134 void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector<IntS ize>& iconSizes)
130 { 135 {
131 ASSERT(iconSizes.isEmpty()); 136 ASSERT(iconSizes.isEmpty());
132 if (value.isEmpty()) 137 if (value.isEmpty())
133 return; 138 return;
134 if (value.is8Bit()) 139 if (value.is8Bit())
135 parseSizes(value.characters8(), value.length(), iconSizes); 140 parseSizes(value.characters8(), value.length(), iconSizes);
136 else 141 else
137 parseSizes(value.characters16(), value.length(), iconSizes); 142 parseSizes(value.characters16(), value.length(), iconSizes);
138 } 143 }
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 return; 699 return;
695 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur l())) 700 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur l()))
696 return; 701 return;
697 if (document().frame() && document().frame()->loader().client()) 702 if (document().frame() && document().frame()->loader().client())
698 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne r->relAttribute().iconType()); 703 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne r->relAttribute().iconType());
699 } 704 }
700 705
701 if (!m_owner->loadLink(type, as, builder.url())) 706 if (!m_owner->loadLink(type, as, builder.url()))
702 return; 707 return;
703 708
709 if (!styleSheetTypeIsSupported(type))
710 UseCounter::countDeprecation(document(), UseCounter::NonCSSStylesheetTyp e);
711
704 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && shouldLoadResource() && builder.url().isValid()) { 712 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && shouldLoadResource() && builder.url().isValid()) {
705 713
706 if (resource()) { 714 if (resource()) {
707 removePendingSheet(); 715 removePendingSheet();
708 clearResource(); 716 clearResource();
709 clearFetchFollowingCORS(); 717 clearFetchFollowingCORS();
710 } 718 }
711 719
712 if (!m_owner->shouldLoadLink()) 720 if (!m_owner->shouldLoadLink())
713 return; 721 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 removePendingSheet(); 774 removePendingSheet();
767 } 775 }
768 776
769 DEFINE_TRACE(LinkStyle) 777 DEFINE_TRACE(LinkStyle)
770 { 778 {
771 visitor->trace(m_sheet); 779 visitor->trace(m_sheet);
772 LinkResource::trace(visitor); 780 LinkResource::trace(visitor);
773 } 781 }
774 782
775 } // namespace blink 783 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698