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

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

Issue 2147853003: Teach 'LinkRequestBuilder' about the 'nonce' attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@preload
Patch Set: 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 // Don't hold up layout tree construction and script execution on styles heets 677 // Don't hold up layout tree construction and script execution on styles heets
678 // that are not needed for the layout at the moment. 678 // that are not needed for the layout at the moment.
679 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner- >isCreatedByParser(); 679 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner- >isCreatedByParser();
680 addPendingSheet(blocking ? Blocking : NonBlocking); 680 addPendingSheet(blocking ? Blocking : NonBlocking);
681 681
682 // Load stylesheets that are not needed for the layout immediately with low priority. 682 // Load stylesheets that are not needed for the layout immediately with low priority.
683 // When the link element is created by scripts, load the stylesheets asy nchronously but in high priority. 683 // When the link element is created by scripts, load the stylesheets asy nchronously but in high priority.
684 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate(); 684 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate();
685 FetchRequest request = builder.build(lowPriority); 685 FetchRequest request = builder.build(lowPriority);
686 request.setContentSecurityPolicyNonce(m_owner->fastGetAttribute(HTMLName s::nonceAttr));
687 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr)); 686 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne r->fastGetAttribute(HTMLNames::crossoriginAttr));
688 if (crossOrigin != CrossOriginAttributeNotSet) { 687 if (crossOrigin != CrossOriginAttributeNotSet) {
689 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin); 688 request.setCrossOriginAccessControl(document().getSecurityOrigin(), crossOrigin);
690 setFetchFollowingCORS(); 689 setFetchFollowingCORS();
691 } 690 }
692 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ; 691 setResource(CSSStyleSheetResource::fetch(request, document().fetcher())) ;
693 692
694 if (m_loading && !resource()) { 693 if (m_loading && !resource()) {
695 // 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. 694 // 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.
696 // 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. 695 // 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
722 } 721 }
723 722
724 DEFINE_TRACE(LinkStyle) 723 DEFINE_TRACE(LinkStyle)
725 { 724 {
726 visitor->trace(m_sheet); 725 visitor->trace(m_sheet);
727 LinkResource::trace(visitor); 726 LinkResource::trace(visitor);
728 ResourceOwner<StyleSheetResource>::trace(visitor); 727 ResourceOwner<StyleSheetResource>::trace(visitor);
729 } 728 }
730 729
731 } // namespace blink 730 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698