Changeset 116757 in webkit


Ignore:
Timestamp:
May 11, 2012 6:04:02 AM (12 years ago)
Author:
keishi@webkit.org
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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116755 r116757  
     12012-05-11  Keishi Hattori  <keishi@webkit.org>
     2
     3        Sanitization algorithm for input type=email should strip whitespaces
     4        https://bugs.webkit.org/show_bug.cgi?id=86177
     5
     6        Reviewed by Kent Tamura.
     7
     8        * fast/forms/ValidityState-typeMismatch-email-expected.txt:
     9        * fast/forms/input-value-sanitization-expected.txt:
     10        * fast/forms/input-value-sanitization.html:
     11        * fast/forms/resources/ValidityState-typeMismatch-email.js:
     12
    1132012-05-11  Alexander Pavlov  <apavlov@chromium.org>
    214
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt

    r89915 r116757  
    3333@p.com" is a valid email address. It was sanitized to "a@p.com".
    3434PASS "" is a valid email address.
     35PASS " " is a valid email address. It was sanitized to "".
     36PASS " a@p.com" is a valid email address. It was sanitized to "a@p.com".
     37PASS "a@p.com " is a valid email address. It was sanitized to "a@p.com".
     38PASS " a@p.com " is a valid email address. It was sanitized to "a@p.com".
     39PASS " a@p.com " is a valid email address. It was sanitized to "a@p.com".
     40PASS "  a@p.com " is a valid email address. It was sanitized to "a@p.com".
     41PASS "
     42a@p.com
     43" is a valid email address. It was sanitized to "a@p.com".
    3544Invalid single addresses when 'multiple' attribute is not set.
    3645PASS "invalid:email@example.com" is a invalid email address.
     
    5059PASS "F/s/f/a@feo+re.com" is a invalid email address.
    5160PASS "some+long+email+address@some+host-weird-/looking.com" is a invalid email address.
    52 PASS " " is a invalid email address.
    53 PASS " a@p.com" is a invalid email address.
    54 PASS "a@p.com " is a invalid email address.
    55 PASS " a@p.com " is a invalid email address.
    56 PASS " a@p.com " is a invalid email address.
    57 PASS "  a@p.com " is a invalid email address.
    58 PASS "
    59 a@p.com
    60 " is a invalid email address.
    61 PASS "
    62 a@p.com
    63 " is a invalid email address.
    64 PASS " a@p.com " is a invalid email address.
    65 PASS " a@p.com " is a invalid email address.
    6661PASS "a @p.com" is a invalid email address.
    6762PASS "a @p.com" is a invalid email address.
  • trunk/LayoutTests/fast/forms/input-value-sanitization-expected.txt

    r97351 r116757  
    55PASS input.value is "tkent@chromium.org,tkent@example.!!!"
    66Email without multiple:
    7 PASS input.value is " tkent@chromium.org, tkent@example.***  "
     7PASS input.value is "tkent@chromium.org, tkent@example.***"
    88
    99Number:
  • trunk/LayoutTests/fast/forms/input-value-sanitization.html

    r98407 r116757  
    2222input.type = 'email';
    2323input.setAttribute('value', ' tkent@chromium.org, tkent@example.***  \r\n');
    24 shouldBe('input.value', '" tkent@chromium.org, tkent@example.***  "');
     24shouldBe('input.value', '"tkent@chromium.org, tkent@example.***"');
    2525
    2626debug('');
  • trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js

    r98407 r116757  
    5050emailCheck("a\u000D@p.com", "a@p.com", expectValid);
    5151emailCheck("", "", expectValid);
     52emailCheck(" ", "", expectValid);
     53emailCheck(" a@p.com", "a@p.com", expectValid);
     54emailCheck("a@p.com ", "a@p.com", expectValid);
     55emailCheck(" a@p.com ", "a@p.com", expectValid);
     56emailCheck("\u0020a@p.com\u0020", "a@p.com", expectValid);
     57emailCheck("\u0009a@p.com\u0009", "a@p.com", expectValid);
     58emailCheck("\u000Ca@p.com\u000C", "a@p.com", expectValid);
    5259
    5360debug("Invalid single addresses when 'multiple' attribute is not set.");
     
    6875emailCheck("F/s/f/a@feo+re.com", "F/s/f/a@feo+re.com", expectInvalid);
    6976emailCheck("some+long+email+address@some+host-weird-/looking.com", "some+long+email+address@some+host-weird-/looking.com", expectInvalid);
    70 emailCheck(" ", " ", expectInvalid);
    71 emailCheck(" a@p.com", " a@p.com", expectInvalid);
    72 emailCheck("a@p.com ", "a@p.com ", expectInvalid);
    73 emailCheck(" a@p.com ", " a@p.com ", expectInvalid);
    74 emailCheck("\u0020a@p.com\u0020", "\u0020a@p.com\u0020", expectInvalid);
    75 emailCheck("\u0009a@p.com\u0009", "\u0009a@p.com\u0009", expectInvalid);
    76 emailCheck("\u000Ba@p.com\u000B", "\u000Ba@p.com\u000B", expectInvalid);
    77 emailCheck("\u000Ca@p.com\u000C", "\u000Ca@p.com\u000C", expectInvalid);
    78 emailCheck("\u2003a@p.com\u2003", "\u2003a@p.com\u2003", expectInvalid);
    79 emailCheck("\u3000a@p.com\u3000", "\u3000a@p.com\u3000", expectInvalid);
    8077emailCheck("a @p.com", "a @p.com", expectInvalid);
    8178emailCheck("a\u0020@p.com", "a\u0020@p.com", expectInvalid);
  • trunk/Source/WebCore/ChangeLog

    r116756 r116757  
     12012-05-11  Keishi Hattori  <keishi@webkit.org>
     2
     3        Sanitization algorithm for input type=email should strip whitespaces
     4        https://bugs.webkit.org/show_bug.cgi?id=86177
     5
     6        Reviewed by Kent Tamura.
     7
     8        No new tests. Covered by: fast/forms/ValidityState-typeMismatch-email.html
     9
     10        The spec says that the value sanitization algorithm should
     11        > Strip line breaks from the value, then strip leading and trailing whitespace from the value.
     12
     13        * html/EmailInputType.cpp:
     14        (WebCore::EmailInputType::sanitizeValue):
     15
    1162012-05-11  Sheriff Bot  <webkit.review.bot@gmail.com>
    217
  • trunk/Source/WebCore/html/EmailInputType.cpp

    r97351 r116757  
    9797    String noLineBreakValue = proposedValue.removeCharacters(isHTMLLineBreak);
    9898    if (!element()->multiple())
    99         return noLineBreakValue;
     99        return stripLeadingAndTrailingHTMLSpaces(noLineBreakValue);
    100100    Vector<String> addresses;
    101101    noLineBreakValue.split(',', true, addresses);
Note: See TracChangeset for help on using the changeset viewer.