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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2801243002: More tweaks to <script nonce> hiding. (Closed)
Patch Set: Element. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
index 4622be44229ed367a3eb51bc199c9da9b8e43f12..a81881279666d1774fb360fbf399d9a324d02e38 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -520,8 +520,7 @@ bool ScriptLoader::FetchScript(const String& source_url,
// 17. "If the script element has a nonce attribute,
// then let cryptographic nonce be that attribute's value.
// Otherwise, let cryptographic nonce be the empty string."
kouhei (in TOK) 2017/04/11 12:24:18 Would you update the spec text here to match: http
- if (element_->IsNonceableElement())
- request.SetContentSecurityPolicyNonce(element_->nonce());
+ request.SetContentSecurityPolicyNonce(element_->GetNonceForElement());
// 19. "Let parser state be "parser-inserted"
// if the script element has been flagged as "parser-inserted",
@@ -666,8 +665,7 @@ bool ScriptLoader::DoExecuteScript(const ScriptSourceCode& source_code) {
csp->AllowScriptWithHash(source_code.Source(),
ContentSecurityPolicy::InlineType::kBlock);
- AtomicString nonce =
- element_->IsNonceableElement() ? element_->nonce() : g_null_atom;
+ const AtomicString& nonce = element_->GetNonceForElement();
if (!is_external_script_ && !should_bypass_main_world_csp &&
!element_->AllowInlineScriptForCSP(nonce, start_line_number_,
source_code.Source())) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptElementBase.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698