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

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

Issue 2801243002: More tweaks to <script nonce> hiding. (Closed)
Patch Set: Moved tests. Created 3 years, 7 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 69a02e0c8e4dbefd77e352bd88b8abc7e78cc5b7..6672d5d0cc23d3f61e605fe55bdf69b9e22c5ed3 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -340,9 +340,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
// 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."
- String nonce;
- if (element_->IsNonceableElement())
- nonce = element_->nonce();
+ String nonce = element_->GetNonceForElement();
// 18. is handled below.
@@ -828,8 +826,7 @@ bool ScriptLoader::DoExecuteScript(const Script* script) {
csp->AllowScriptWithHash(script->InlineSourceTextForCSP(),
ContentSecurityPolicy::InlineType::kBlock);
- AtomicString nonce =
- element_->IsNonceableElement() ? element_->nonce() : g_null_atom;
+ AtomicString nonce = element_->GetNonceForElement();
if (!should_bypass_main_world_csp &&
!element_->AllowInlineScriptForCSP(nonce, start_line_number_,
script->InlineSourceTextForCSP())) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptElementBase.h ('k') | third_party/WebKit/Source/core/dom/StyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698