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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleElement.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) 2006, 2007 Rob Buis 2 * Copyright (C) 2006, 2007 Rob Buis
3 * Copyright (C) 2008 Apple, Inc. All rights reserved. 3 * Copyright (C) 2008 Apple, Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 StyleElement::ProcessingResult StyleElement::createSheet(Element* e, const Strin g& text) 169 StyleElement::ProcessingResult StyleElement::createSheet(Element* e, const Strin g& text)
170 { 170 {
171 DCHECK(e); 171 DCHECK(e);
172 DCHECK(e->inShadowIncludingDocument()); 172 DCHECK(e->inShadowIncludingDocument());
173 Document& document = e->document(); 173 Document& document = e->document();
174 174
175 const ContentSecurityPolicy* csp = document.contentSecurityPolicy(); 175 const ContentSecurityPolicy* csp = document.contentSecurityPolicy();
176 bool passesContentSecurityPolicyChecks = shouldBypassMainWorldCSP(e) 176 bool passesContentSecurityPolicyChecks = shouldBypassMainWorldCSP(e)
177 || csp->allowStyleWithHash(text, ContentSecurityPolicy::InlineType::Bloc k) 177 || csp->allowStyleWithHash(text, ContentSecurityPolicy::InlineType::Bloc k)
178 || csp->allowStyleWithNonce(e->fastGetAttribute(HTMLNames::nonceAttr)) 178 || csp->allowInlineStyle(e->document().url(), e->fastGetAttribute(HTMLNa mes::nonceAttr), m_startPosition.m_line, text);
179 || csp->allowInlineStyle(e->document().url(), m_startPosition.m_line, te xt);
180 179
181 // Clearing the current sheet may remove the cache entry so create the new s heet first 180 // Clearing the current sheet may remove the cache entry so create the new s heet first
182 CSSStyleSheet* newSheet = nullptr; 181 CSSStyleSheet* newSheet = nullptr;
183 182
184 // If type is empty or CSS, this is a CSS style sheet. 183 // If type is empty or CSS, this is a CSS style sheet.
185 const AtomicString& type = this->type(); 184 const AtomicString& type = this->type();
186 if (isCSS(e, type) && passesContentSecurityPolicyChecks) { 185 if (isCSS(e, type) && passesContentSecurityPolicyChecks) {
187 MediaQuerySet* mediaQueries = MediaQuerySet::create(media()); 186 MediaQuerySet* mediaQueries = MediaQuerySet::create(media());
188 187
189 MediaQueryEvaluator screenEval("screen", true); 188 MediaQueryEvaluator screenEval("screen", true);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 { 226 {
228 document.styleEngine().addPendingSheet(m_styleEngineContext); 227 document.styleEngine().addPendingSheet(m_styleEngineContext);
229 } 228 }
230 229
231 DEFINE_TRACE(StyleElement) 230 DEFINE_TRACE(StyleElement)
232 { 231 {
233 visitor->trace(m_sheet); 232 visitor->trace(m_sheet);
234 } 233 }
235 234
236 } // namespace blink 235 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.cpp ('k') | third_party/WebKit/Source/core/fetch/FetchRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698