Index: third_party/WebKit/Source/core/html/HTMLElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp |
index 51ba6f18bda81b3e4268cffa76753c03cd05c97a..e532670190f77722ec7c91dde98b7b54d088977f 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp |
@@ -52,6 +52,7 @@ |
#include "core/events/KeyboardEvent.h" |
#include "core/frame/Settings.h" |
#include "core/frame/UseCounter.h" |
+#include "core/frame/csp/ContentSecurityPolicy.h" |
#include "core/html/HTMLBRElement.h" |
#include "core/html/HTMLDimension.h" |
#include "core/html/HTMLFormElement.h" |
@@ -910,6 +911,24 @@ void HTMLElement::AdjustDirectionalityIfNeededAfterChildrenChanged( |
} |
} |
+Node::InsertionNotificationRequest HTMLElement::InsertedInto( |
+ ContainerNode* insertion_point) { |
+ // Process the superclass first to ensure that `InActiveDocument()` is |
+ // updated. |
+ Element::InsertedInto(insertion_point); |
+ |
+ if (hasAttribute(nonceAttr) && getAttribute(nonceAttr) != g_empty_atom) { |
+ setNonce(getAttribute(nonceAttr)); |
+ if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled() && |
+ InActiveDocument() && |
+ GetDocument().GetContentSecurityPolicy()->HasHeaderDeliveredPolicy()) { |
+ setAttribute(nonceAttr, g_empty_atom); |
+ } |
+ } |
+ |
+ return kInsertionDone; |
+} |
+ |
void HTMLElement::AddHTMLLengthToStyle(MutableStylePropertySet* style, |
CSSPropertyID property_id, |
const String& value, |