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

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: Created 5 years 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
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 bool LinkStyle::styleSheetIsLoading() const 585 bool LinkStyle::styleSheetIsLoading() const
586 { 586 {
587 if (m_loading) 587 if (m_loading)
588 return true; 588 return true;
589 if (!m_sheet) 589 if (!m_sheet)
590 return false; 590 return false;
591 return m_sheet->contents()->isLoading(); 591 return m_sheet->contents()->isLoading();
592 } 592 }
593 593
594 bool LinkStyle::styleSheetTypeIsSupported(const String& type) const
esprehn 2015/12/17 07:07:07 This is static it doesn't need to be a method, mov
suzyh_UTC10 (ex-contributor) 2016/01/18 07:28:27 Done.
595 {
596 return type.isEmpty() || type.contains("text/css");
597 }
598
594 void LinkStyle::addPendingSheet(PendingSheetType type) 599 void LinkStyle::addPendingSheet(PendingSheetType type)
595 { 600 {
596 if (type <= m_pendingSheetType) 601 if (type <= m_pendingSheetType)
597 return; 602 return;
598 m_pendingSheetType = type; 603 m_pendingSheetType = type;
599 604
600 if (m_pendingSheetType == NonBlocking) 605 if (m_pendingSheetType == NonBlocking)
601 return; 606 return;
602 m_owner->document().styleEngine().addPendingSheet(); 607 m_owner->document().styleEngine().addPendingSheet();
603 } 608 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 return; 693 return;
689 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur l())) 694 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur l()))
690 return; 695 return;
691 if (document().frame() && document().frame()->loader().client()) 696 if (document().frame() && document().frame()->loader().client())
692 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne r->relAttribute().iconType()); 697 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne r->relAttribute().iconType());
693 } 698 }
694 699
695 if (!m_owner->loadLink(type, as, builder.url())) 700 if (!m_owner->loadLink(type, as, builder.url()))
696 return; 701 return;
697 702
698 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && shouldLoadResource() && builder.url().isValid()) { 703 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && styleSheetTypeIsSupported(type) && shouldLoadResource() && builder.url().isVali d()) {
699 704
700 if (resource()) { 705 if (resource()) {
701 removePendingSheet(); 706 removePendingSheet();
702 clearResource(); 707 clearResource();
703 clearFetchFollowingCORS(); 708 clearFetchFollowingCORS();
704 } 709 }
705 710
706 if (!m_owner->shouldLoadLink()) 711 if (!m_owner->shouldLoadLink())
707 return; 712 return;
708 713
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 removePendingSheet(); 765 removePendingSheet();
761 } 766 }
762 767
763 DEFINE_TRACE(LinkStyle) 768 DEFINE_TRACE(LinkStyle)
764 { 769 {
765 visitor->trace(m_sheet); 770 visitor->trace(m_sheet);
766 LinkResource::trace(visitor); 771 LinkResource::trace(visitor);
767 } 772 }
768 773
769 } // namespace blink 774 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698