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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.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/svg/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 452f24e069c1ef0422edca218d0dc3559ba10685..7b4e56a8a23972bcac4f9cb85c3c094d1bd6504e 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -40,6 +40,7 @@
#include "core/dom/shadow/ShadowRoot.h"
#include "core/events/Event.h"
#include "core/frame/Settings.h"
+#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/html/HTMLElement.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/layout/LayoutObject.h"
@@ -407,6 +408,16 @@ Node::InsertionNotificationRequest SVGElement::InsertedInto(
Element::InsertedInto(root_parent);
UpdateRelativeLengthsInformation();
BuildPendingResourcesIfNeeded();
+
+ 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;
}
« no previous file with comments | « third_party/WebKit/Source/core/html/LinkResource.cpp ('k') | third_party/WebKit/Source/core/svg/SVGElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698