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

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

Issue 2020223002: Refactor nonce support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inline
Patch Set: Rebase. Created 4 years, 6 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 740
741 // Don't hold up layout tree construction and script execution on styles heets 741 // Don't hold up layout tree construction and script execution on styles heets
742 // that are not needed for the layout at the moment. 742 // that are not needed for the layout at the moment.
743 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner- >isCreatedByParser(); 743 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner- >isCreatedByParser();
744 addPendingSheet(blocking ? Blocking : NonBlocking); 744 addPendingSheet(blocking ? Blocking : NonBlocking);
745 745
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 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr)); 751 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr));
751 if (crossOrigin != CrossOriginAttributeNotSet) { 752 if (crossOrigin != CrossOriginAttributeNotSet) {
752 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin); 753 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin);
753 setFetchFollowingCORS(); 754 setFetchFollowingCORS();
754 } 755 }
755 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ; 756 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ;
756 757
757 if (m_loading && !resource()) { 758 if (m_loading && !resource()) {
758 // 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. 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.
759 // 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. 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.
(...skipping 25 matching lines...) Expand all
785 } 786 }
786 787
787 DEFINE_TRACE(LinkStyle) 788 DEFINE_TRACE(LinkStyle)
788 { 789 {
789 visitor->trace(m_sheet); 790 visitor->trace(m_sheet);
790 LinkResource::trace(visitor); 791 LinkResource::trace(visitor);
791 ResourceOwner<StyleSheetResource>::trace(visitor); 792 ResourceOwner<StyleSheetResource>::trace(visitor);
792 } 793 }
793 794
794 } // namespace blink 795 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698