Title: [116757] trunk
Revision
116757
Author
kei...@webkit.org
Date
2012-05-11 06:04:02 -0700 (Fri, 11 May 2012)

Log Message

Sanitization algorithm for input type=email should strip whitespaces
https://bugs.webkit.org/show_bug.cgi?id=86177

Reviewed by Kent Tamura.

Source/WebCore:

No new tests. Covered by: fast/forms/ValidityState-typeMismatch-email.html

The spec says that the value sanitization algorithm should
> Strip line breaks from the value, then strip leading and trailing whitespace from the value.

* html/EmailInputType.cpp:
(WebCore::EmailInputType::sanitizeValue):

LayoutTests:

* fast/forms/ValidityState-typeMismatch-email-expected.txt:
* fast/forms/input-value-sanitization-expected.txt:
* fast/forms/input-value-sanitization.html:
* fast/forms/resources/ValidityState-typeMismatch-email.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116756 => 116757)


--- trunk/LayoutTests/ChangeLog	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/LayoutTests/ChangeLog	2012-05-11 13:04:02 UTC (rev 116757)
@@ -1,3 +1,15 @@
+2012-05-11  Keishi Hattori  <kei...@webkit.org>
+
+        Sanitization algorithm for input type=email should strip whitespaces
+        https://bugs.webkit.org/show_bug.cgi?id=86177
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/ValidityState-typeMismatch-email-expected.txt:
+        * fast/forms/input-value-sanitization-expected.txt:
+        * fast/forms/input-value-sanitization.html:
+        * fast/forms/resources/ValidityState-typeMismatch-email.js:
+
 2012-05-11  Alexander Pavlov  <apav...@chromium.org>
 
         Web Inspector: Search box doesn't allow CSS selectors anymore

Modified: trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt (116756 => 116757)


--- trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt	2012-05-11 13:04:02 UTC (rev 116757)
@@ -32,6 +32,13 @@
 PASS "a
 @p.com" is a valid email address. It was sanitized to "a...@p.com".
 PASS "" is a valid email address. 
+PASS " " is a valid email address. It was sanitized to "".
+PASS " a...@p.com" is a valid email address. It was sanitized to "a...@p.com".
+PASS "a...@p.com " is a valid email address. It was sanitized to "a...@p.com".
+PASS " a...@p.com " is a valid email address. It was sanitized to "a...@p.com".
+PASS " a...@p.com " is a valid email address. It was sanitized to "a...@p.com".
+PASS "	a...@p.com	" is a valid email address. It was sanitized to "a...@p.com".
+PASS "a...@p.com" is a valid email address. It was sanitized to "a...@p.com".
 Invalid single addresses when 'multiple' attribute is not set.
 PASS "invalid:em...@example.com" is a invalid email address. 
 PASS "@somewhere.com" is a invalid email address. 
@@ -49,16 +56,6 @@
 PASS "." is a invalid email address. 
 PASS "F/s/f/a@feo+re.com" is a invalid email address. 
 PASS "some+long+email+address@some+host-weird-/looking.com" is a invalid email address. 
-PASS " " is a invalid email address. 
-PASS " a...@p.com" is a invalid email address. 
-PASS "a...@p.com " is a invalid email address. 
-PASS " a...@p.com " is a invalid email address. 
-PASS " a...@p.com " is a invalid email address. 
-PASS "	a...@p.com	" is a invalid email address. 
-PASS "a...@p.com" is a invalid email address. 
-PASS "a...@p.com" is a invalid email address. 
-PASS " a...@p.com " is a invalid email address. 
-PASS " a...@p.com " is a invalid email address. 
 PASS "a @p.com" is a invalid email address. 
 PASS "a @p.com" is a invalid email address. 
 PASS "a	@p.com" is a invalid email address. 

Modified: trunk/LayoutTests/fast/forms/input-value-sanitization-expected.txt (116756 => 116757)


--- trunk/LayoutTests/fast/forms/input-value-sanitization-expected.txt	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/LayoutTests/fast/forms/input-value-sanitization-expected.txt	2012-05-11 13:04:02 UTC (rev 116757)
@@ -4,7 +4,7 @@
 Email with multiple:
 PASS input.value is "tk...@chromium.org,tkent@example.!!!"
 Email without multiple:
-PASS input.value is " tk...@chromium.org, tkent@example.***  "
+PASS input.value is "tk...@chromium.org, tkent@example.***"
 
 Number:
 PASS input.value is "65536"

Modified: trunk/LayoutTests/fast/forms/input-value-sanitization.html (116756 => 116757)


--- trunk/LayoutTests/fast/forms/input-value-sanitization.html	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/LayoutTests/fast/forms/input-value-sanitization.html	2012-05-11 13:04:02 UTC (rev 116757)
@@ -21,7 +21,7 @@
 input.multiple = false;
 input.type = 'email';
 input.setAttribute('value', ' tk...@chromium.org, tkent@example.***  \r\n');
-shouldBe('input.value', '" tk...@chromium.org, tkent@example.***  "');
+shouldBe('input.value', '"tk...@chromium.org, tkent@example.***"');
 
 debug('');
 debug('Number:');

Modified: trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js (116756 => 116757)


--- trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js	2012-05-11 13:04:02 UTC (rev 116757)
@@ -49,6 +49,13 @@
 emailCheck("a\u0...@p.com", "a...@p.com", expectValid);
 emailCheck("a\u0...@p.com", "a...@p.com", expectValid);
 emailCheck("", "", expectValid);
+emailCheck(" ", "", expectValid);
+emailCheck(" a...@p.com", "a...@p.com", expectValid);
+emailCheck("a...@p.com ", "a...@p.com", expectValid);
+emailCheck(" a...@p.com ", "a...@p.com", expectValid);
+emailCheck("\u00...@p.com\u0020", "a...@p.com", expectValid);
+emailCheck("\u00...@p.com\u0009", "a...@p.com", expectValid);
+emailCheck("\u00...@p.com\u000C", "a...@p.com", expectValid);
 
 debug("Invalid single addresses when 'multiple' attribute is not set.");
 emailCheck("invalid:em...@example.com", "invalid:em...@example.com", expectInvalid);
@@ -67,16 +74,6 @@
 emailCheck(".", ".", expectInvalid);
 emailCheck("F/s/f/a@feo+re.com", "F/s/f/a@feo+re.com", expectInvalid);
 emailCheck("some+long+email+address@some+host-weird-/looking.com", "some+long+email+address@some+host-weird-/looking.com", expectInvalid);
-emailCheck(" ", " ", expectInvalid);
-emailCheck(" a...@p.com", " a...@p.com", expectInvalid);
-emailCheck("a...@p.com ", "a...@p.com ", expectInvalid);
-emailCheck(" a...@p.com ", " a...@p.com ", expectInvalid);
-emailCheck("\u00...@p.com\u0020", "\u00...@p.com\u0020", expectInvalid);
-emailCheck("\u00...@p.com\u0009", "\u00...@p.com\u0009", expectInvalid);
-emailCheck("\u00...@p.com\u000B", "\u00...@p.com\u000B", expectInvalid);
-emailCheck("\u00...@p.com\u000C", "\u00...@p.com\u000C", expectInvalid);
-emailCheck("\u20...@p.com\u2003", "\u20...@p.com\u2003", expectInvalid);
-emailCheck("\u30...@p.com\u3000", "\u30...@p.com\u3000", expectInvalid);
 emailCheck("a @p.com", "a @p.com", expectInvalid);
 emailCheck("a\u0...@p.com", "a\u0...@p.com", expectInvalid);
 emailCheck("a\u0...@p.com", "a\u0...@p.com", expectInvalid);

Modified: trunk/Source/WebCore/ChangeLog (116756 => 116757)


--- trunk/Source/WebCore/ChangeLog	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/Source/WebCore/ChangeLog	2012-05-11 13:04:02 UTC (rev 116757)
@@ -1,3 +1,18 @@
+2012-05-11  Keishi Hattori  <kei...@webkit.org>
+
+        Sanitization algorithm for input type=email should strip whitespaces
+        https://bugs.webkit.org/show_bug.cgi?id=86177
+
+        Reviewed by Kent Tamura.
+
+        No new tests. Covered by: fast/forms/ValidityState-typeMismatch-email.html
+
+        The spec says that the value sanitization algorithm should
+        > Strip line breaks from the value, then strip leading and trailing whitespace from the value.
+
+        * html/EmailInputType.cpp:
+        (WebCore::EmailInputType::sanitizeValue):
+
 2012-05-11  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r116752.

Modified: trunk/Source/WebCore/html/EmailInputType.cpp (116756 => 116757)


--- trunk/Source/WebCore/html/EmailInputType.cpp	2012-05-11 12:56:04 UTC (rev 116756)
+++ trunk/Source/WebCore/html/EmailInputType.cpp	2012-05-11 13:04:02 UTC (rev 116757)
@@ -96,7 +96,7 @@
 {
     String noLineBreakValue = proposedValue.removeCharacters(isHTMLLineBreak);
     if (!element()->multiple())
-        return noLineBreakValue;
+        return stripLeadingAndTrailingHTMLSpaces(noLineBreakValue);
     Vector<String> addresses;
     noLineBreakValue.split(',', true, addresses);
     StringBuilder strippedValue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to