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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2056183002: Implement the `require-sri-for` CSP directive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests Created 4 years, 5 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
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 // Load stylesheets that are not needed for the layout immediately with low priority. 746 // Load stylesheets that are not needed for the layout immediately with low priority.
747 // When the link element is created by scripts, load the stylesheets asy nchronously but in high priority. 747 // When the link element is created by scripts, load the stylesheets asy nchronously but in high priority.
748 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate(); 748 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate();
749 FetchRequest request = builder.build(lowPriority); 749 FetchRequest request = builder.build(lowPriority);
750 request.setContentSecurityPolicyNonce(m_owner->fastGetAttribute(HTMLName s::nonceAttr)); 750 request.setContentSecurityPolicyNonce(m_owner->fastGetAttribute(HTMLName s::nonceAttr));
751 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr)); 751 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr));
752 if (crossOrigin != CrossOriginAttributeNotSet) { 752 if (crossOrigin != CrossOriginAttributeNotSet) {
753 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin); 753 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin);
754 setFetchFollowingCORS(); 754 setFetchFollowingCORS();
755 } 755 }
756
757 String integrityAttr = m_owner->fastGetAttribute(HTMLNames::integrityAtt r);
758 if (!integrityAttr.isEmpty()) {
759 IntegrityMetadataSet metadataSet;
760 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadat aSet);
761 request.setIntegrityMetadata(metadataSet);
762 }
756 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ; 763 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ;
757 764
758 if (m_loading && !resource()) { 765 if (m_loading && !resource()) {
759 // The request may have been denied if (for example) the stylesheet is local and the document is remote, or if there was a Content Security Policy F ailure. 766 // The request may have been denied if (for example) the stylesheet is local and the document is remote, or if there was a Content Security Policy F ailure.
760 // setCSSStyleSheet() can be called synchronuosly in setResource() a nd thus resource() is null and |m_loading| is false in such cases even if the re quest succeeds. 767 // setCSSStyleSheet() can be called synchronuosly in setResource() a nd thus resource() is null and |m_loading| is false in such cases even if the re quest succeeds.
761 m_loading = false; 768 m_loading = false;
762 removePendingSheet(); 769 removePendingSheet();
763 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi ngSubresource); 770 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi ngSubresource);
764 } 771 }
765 } else if (m_sheet) { 772 } else if (m_sheet) {
(...skipping 20 matching lines...) Expand all
786 } 793 }
787 794
788 DEFINE_TRACE(LinkStyle) 795 DEFINE_TRACE(LinkStyle)
789 { 796 {
790 visitor->trace(m_sheet); 797 visitor->trace(m_sheet);
791 LinkResource::trace(visitor); 798 LinkResource::trace(visitor);
792 ResourceOwner<StyleSheetResource>::trace(visitor); 799 ResourceOwner<StyleSheetResource>::trace(visitor);
793 } 800 }
794 801
795 } // namespace blink 802 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698