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

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

Issue 2560693002: Disable form elements in MHTML (Closed)
Patch Set: Address feedback Created 4 years 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 468e236bc0b3d303436561a3a4e1741d26c6d2a6..c55b93924d12eae3889e970b0712da1b072b2419 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
@@ -220,4 +220,20 @@ TEST_F(WebFrameSerializerSanitizationTest, RemoveInlineScriptInAttributes) {
EXPECT_NE(WTF::kNotFound, mhtml.find("src="));
}
+TEST_F(WebFrameSerializerSanitizationTest, DisableFormElements) {
+ String mhtml = generateMHTMLParts("http://www.test.com", "form.html");
+
+ int matches = 0;
+ size_t start = 0;
+ while (true) {
+ const char kDisabledAttr[] = "disabled=3D\"\"";
+ size_t pos = mhtml.find(kDisabledAttr, start);
+ if (pos == WTF::kNotFound)
+ break;
+ matches++;
+ start = pos + arraysize(kDisabledAttr) - 1;
+ }
+ EXPECT_EQ(21, matches);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698