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

Unified Diff: third_party/WebKit/Source/core/dom/Element.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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/ElementRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 406ccfc9b05755070367a8ca7eaf22f6ba2fb7c2..8bdd0b8ad69cf16d76e95b77ec0eb9cc40c23c2d 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -430,6 +430,14 @@ AtomicString Element::LowercaseIfNecessary(const AtomicString& name) const {
: name;
}
+const AtomicString& Element::nonce() const {
+ return HasRareData() ? GetElementRareData()->GetNonce() : g_empty_atom;
+}
+
+void Element::setNonce(const AtomicString& nonce) {
+ EnsureElementRareData().SetNonce(nonce);
+}
+
void Element::scrollIntoView(bool align_to_top) {
GetDocument().EnsurePaintLocationDataValidForNode(this);
@@ -3993,6 +4001,9 @@ void Element::CloneAttributesFromElement(const Element& other) {
AttributeChangedFromParserOrByCloning(
attr.GetName(), attr.Value(), AttributeModificationReason::kByCloning);
}
+
+ if (other.nonce() != g_null_atom)
+ setNonce(other.nonce());
}
void Element::CloneDataFromElement(const Element& other) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698