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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp

Issue 2713663003: Do not serialize meta element containing Content-Security-Policy (Closed)
Patch Set: Created 3 years, 10 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/web/tests/WebFrameSerializerTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
index 9459bfcadba84d417b56dfbad3f2924625768ad9..4d48769439eb14d2d110cef479267e96b326bc63 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
@@ -368,10 +368,18 @@ TEST_F(WebFrameSerializerSanitizationTest, KeepPopupOverlayIfNotRequested) {
TEST_F(WebFrameSerializerSanitizationTest, RemoveElements) {
String mhtml =
generateMHTMLParts("http://www.test.com", "remove_elements.html");
+ LOG(ERROR) << mhtml;
EXPECT_EQ(WTF::kNotFound, mhtml.find("<script"));
EXPECT_EQ(WTF::kNotFound, mhtml.find("<noscript"));
+ // Only the meta element containing "Content-Security-Policy" is removed.
+ // Other meta elements should be preserved.
+ EXPECT_EQ(WTF::kNotFound,
+ mhtml.find("<meta http-equiv=3D\"Content-Security-Policy"));
+ EXPECT_NE(WTF::kNotFound, mhtml.find("<meta name=3D\"description"));
+ EXPECT_NE(WTF::kNotFound, mhtml.find("<meta http-equiv=3D\"refresh"));
+
// If an element is removed, its children should also be skipped.
EXPECT_EQ(WTF::kNotFound, mhtml.find("<select"));
EXPECT_EQ(WTF::kNotFound, mhtml.find("<option"));

Powered by Google App Engine
This is Rietveld 408576698