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

Unified Diff: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp

Issue 2372563002: Adding Embedding-CSP HTTP header (Closed)
Patch Set: Check for ascii and add console error message Created 4 years, 3 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/HTMLIFrameElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
index 9e956903a26e651ea66d4c1b3b3acaba6a5a5507..466242d9f1139a588ebb5ddc0698b918f0181e9a 100644
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
@@ -121,6 +121,12 @@ void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicSt
if (initializePermissionsAttribute())
m_permissions->setValue(value);
} else if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && name == cspAttr) {
+ for (size_t i = 0; i < value.length(); ++i) {
Mike West 2016/09/29 13:33:13 You can replace this loop with `value.containsOnly
+ if (!isASCII(value[i])) {
+ document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "'csp' attribute contains non-ASCII characters: " + value));
+ return;
+ }
+ }
AtomicString oldCSP = m_csp;
m_csp = value;
if (m_csp != oldCSP)

Powered by Google App Engine
This is Rietveld 408576698