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

Unified Diff: third_party/WebKit/Source/core/html/HTMLElement.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/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,
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.h ('k') | third_party/WebKit/Source/core/html/HTMLElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698