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

Unified Diff: third_party/WebKit/Source/core/html/HTMLScriptElement.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/html/HTMLScriptElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp b/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
index 3d794624e070c14d064e8f4bcc813319de6bca35..257922a2df00500ff01c8bba1a01164b02cbdb8d 100644
--- a/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
@@ -89,14 +89,6 @@ void HTMLScriptElement::ParseAttribute(
LogUpdateAttributeIfIsolatedWorldAndInDocument("script", params);
} else if (params.name == asyncAttr) {
loader_->HandleAsyncAttribute();
- } else if (params.name == nonceAttr) {
- if (params.new_value == ContentSecurityPolicy::GetNonceReplacementString())
- return;
- setNonce(params.new_value);
- if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled()) {
- setAttribute(nonceAttr,
- ContentSecurityPolicy::GetNonceReplacementString());
- }
} else {
HTMLElement::ParseAttribute(params);
}
@@ -112,6 +104,7 @@ Node::InsertionNotificationRequest HTMLScriptElement::InsertedInto(
UseCounter::kScriptElementWithInvalidTypeHasSrc);
HTMLElement::InsertedInto(insertion_point);
LogAddElementIfIsolatedWorldAndInDocument("script", srcAttr);
+
return kInsertionShouldCallDidNotifySubtreeInsertions;
}
@@ -200,8 +193,9 @@ bool HTMLScriptElement::HasChildren() const {
return Node::hasChildren();
}
-bool HTMLScriptElement::IsNonceableElement() const {
- return ContentSecurityPolicy::IsNonceableElement(this);
+const AtomicString& HTMLScriptElement::GetNonceForElement() const {
+ return ContentSecurityPolicy::IsNonceableElement(this) ? nonce()
+ : g_null_atom;
}
bool HTMLScriptElement::AllowInlineScriptForCSP(
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLScriptElement.h ('k') | third_party/WebKit/Source/core/html/HTMLScriptElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698