<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210361] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210361">210361</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-01-05 10:31:27 -0800 (Thu, 05 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Form validation: Align email validation with the latest HTML specification
https://bugs.webkit.org/show_bug.cgi?id=166697
&lt;rdar://problem/29870245&gt;

Reviewed by Alex Christensen.

Source/WebCore:

Align email validation with the latest HTML specification:
- https://html.spec.whatwg.org/#valid-e-mail-address

It particular, the following changes were made:
- The first and last character of the domain now needs to be a letter or a digit
- Parts of the domain can only be 63 characters in length

No new tests, extended existing test.

* html/EmailInputType.cpp:

LayoutTests:

Extended / updated existing layout test to cover behavior changes.

* fast/forms/ValidityState-typeMismatch-email-expected.txt:
* fast/forms/resources/ValidityState-typeMismatch-email.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatetypeMismatchemailexpectedtxt">trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsresourcesValidityStatetypeMismatchemailjs">trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlEmailInputTypecpp">trunk/Source/WebCore/html/EmailInputType.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210360 => 210361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-05 18:29:00 UTC (rev 210360)
+++ trunk/LayoutTests/ChangeLog        2017-01-05 18:31:27 UTC (rev 210361)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-01-05  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Form validation: Align email validation with the latest HTML specification
+        https://bugs.webkit.org/show_bug.cgi?id=166697
+        &lt;rdar://problem/29870245&gt;
+
+        Reviewed by Alex Christensen.
+
+        Extended / updated existing layout test to cover behavior changes.
+
+        * fast/forms/ValidityState-typeMismatch-email-expected.txt:
+        * fast/forms/resources/ValidityState-typeMismatch-email.js:
+
</ins><span class="cx"> 2017-01-05  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r210226): overflow:scroll scroll position not restored on back navigation
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatetypeMismatchemailexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt (210360 => 210361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt        2017-01-05 18:29:00 UTC (rev 210360)
+++ trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-email-expected.txt        2017-01-05 18:31:27 UTC (rev 210361)
</span><span class="lines">@@ -10,7 +10,6 @@
</span><span class="cx"> PASS &quot;a@b.b&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;a/b@domain.com&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;{}@domain.com&quot; is a valid email address. 
</span><del>-PASS &quot;ddjk-s-jk@asl-.com&quot; is a valid email address. 
</del><span class="cx"> PASS &quot;m*'!%@something.sa&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;tu!!7n7.ad##0!!!@company.ca&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;%@com.com&quot; is a valid email address. 
</span><span class="lines">@@ -18,8 +17,6 @@
</span><span class="cx"> PASS &quot;.wooly@example.com&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;wo..oly@example.com&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;someone@do-ma-in.com&quot; is a valid email address. 
</span><del>-PASS &quot;someone@do-.com&quot; is a valid email address. 
-PASS &quot;somebody@-.com&quot; is a valid email address. 
</del><span class="cx"> PASS &quot;somebody@example&quot; is a valid email address. 
</span><span class="cx"> PASS &quot;
</span><span class="cx"> a@p.com
</span><span class="lines">@@ -39,6 +36,8 @@
</span><span class="cx"> PASS &quot; a@p.com &quot; is a valid email address. It was sanitized to &quot;a@p.com&quot;.
</span><span class="cx"> PASS &quot;        a@p.com        &quot; is a valid email address. It was sanitized to &quot;a@p.com&quot;.
</span><span class="cx"> PASS &quot; a@p.com &quot; is a valid email address. It was sanitized to &quot;a@p.com&quot;.
</span><ins>+PASS &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot; is a valid email address. 
+PASS &quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot; is a valid email address. 
</ins><span class="cx"> Invalid single addresses when 'multiple' attribute is not set.
</span><span class="cx"> PASS &quot;invalid:email@example.com&quot; is a invalid email address. 
</span><span class="cx"> PASS &quot;@somewhere.com&quot; is a invalid email address. 
</span><span class="lines">@@ -63,6 +62,11 @@
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address. 
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address. 
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address. 
</span><ins>+PASS &quot;ddjk-s-jk@asl-.com&quot; is a invalid email address. 
+PASS &quot;someone@do-.com&quot; is a invalid email address. 
+PASS &quot;somebody@-.com&quot; is a invalid email address. 
+PASS &quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot; is a invalid email address. 
+PASS &quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot; is a invalid email address. 
</ins><span class="cx"> Valid single addresses when 'multiple' attribute is set.
</span><span class="cx"> PASS &quot;something@something.com&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;someone@localhost.localdomain&quot; is a valid email address list. 
</span><span class="lines">@@ -70,7 +74,6 @@
</span><span class="cx"> PASS &quot;a@b.b&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;a/b@domain.com&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;{}@domain.com&quot; is a valid email address list. 
</span><del>-PASS &quot;ddjk-s-jk@asl-.com&quot; is a valid email address list. 
</del><span class="cx"> PASS &quot;m*'!%@something.sa&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;tu!!7n7.ad##0!!!@company.ca&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;%@com.com&quot; is a valid email address list. 
</span><span class="lines">@@ -78,8 +81,6 @@
</span><span class="cx"> PASS &quot;.wooly@example.com&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;wo..oly@example.com&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;someone@do-ma-in.com&quot; is a valid email address list. 
</span><del>-PASS &quot;someone@do-.com&quot; is a valid email address list. 
-PASS &quot;somebody@-.com&quot; is a valid email address list. 
</del><span class="cx"> PASS &quot;somebody@example&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot; a@p.com &quot; is a valid email address list. It was sanitized to &quot;a@p.com&quot;.
</span><span class="cx"> PASS &quot;        a@p.com        &quot; is a valid email address list. It was sanitized to &quot;a@p.com&quot;.
</span><span class="lines">@@ -99,6 +100,8 @@
</span><span class="cx"> PASS &quot; a@p.com&quot; is a valid email address list. It was sanitized to &quot;a@p.com&quot;.
</span><span class="cx"> PASS &quot;a@p.com &quot; is a valid email address list. It was sanitized to &quot;a@p.com&quot;.
</span><span class="cx"> PASS &quot; a@p.com &quot; is a valid email address list. It was sanitized to &quot;a@p.com&quot;.
</span><ins>+PASS &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot; is a valid email address list. 
+PASS &quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot; is a valid email address list. 
</ins><span class="cx"> Invalid single addresses when 'multiple' attribute is set.
</span><span class="cx"> PASS &quot;invalid:email@example.com&quot; is a invalid email address list. 
</span><span class="cx"> PASS &quot;@somewhere.com&quot; is a invalid email address list. 
</span><span class="lines">@@ -126,6 +129,11 @@
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address list. 
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address list. 
</span><span class="cx"> PASS &quot;a @p.com&quot; is a invalid email address list. 
</span><ins>+PASS &quot;ddjk-s-jk@asl-.com&quot; is a invalid email address list. 
+PASS &quot;someone@do-.com&quot; is a invalid email address list. 
+PASS &quot;somebody@-.com&quot; is a invalid email address list. 
+PASS &quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot; is a invalid email address list. 
+PASS &quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot; is a invalid email address list. 
</ins><span class="cx"> Valid multiple addresses when 'multiple' attribute is set.
</span><span class="cx"> PASS &quot;someone@somewhere.com,john@doe.com,a@b.c,a/b@c.c,ualla@ualla.127&quot; is a valid email address list. 
</span><span class="cx"> PASS &quot;tu!!7n7.ad##0!!!@company.ca,F/s/f/a@feo-re.com,m*'@a.b&quot; is a valid email address list. 
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsresourcesValidityStatetypeMismatchemailjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js (210360 => 210361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js        2017-01-05 18:29:00 UTC (rev 210360)
+++ trunk/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js        2017-01-05 18:31:27 UTC (rev 210361)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> emailCheck(&quot;a@b.b&quot;, &quot;a@b.b&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;a/b@domain.com&quot;, &quot;a/b@domain.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;{}@domain.com&quot;, &quot;{}@domain.com&quot;, expectValid);
</span><del>-emailCheck(&quot;ddjk-s-jk@asl-.com&quot;, &quot;ddjk-s-jk@asl-.com&quot;, expectValid);
</del><span class="cx"> emailCheck(&quot;m*'!%@something.sa&quot;, &quot;m*'!%@something.sa&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;tu!!7n7.ad##0!!!@company.ca&quot;, &quot;tu!!7n7.ad##0!!!@company.ca&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;%@com.com&quot;, &quot;%@com.com&quot;, expectValid);
</span><span class="lines">@@ -41,8 +40,6 @@
</span><span class="cx"> emailCheck(&quot;.wooly@example.com&quot;, &quot;.wooly@example.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;wo..oly@example.com&quot;, &quot;wo..oly@example.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;someone@do-ma-in.com&quot;, &quot;someone@do-ma-in.com&quot;, expectValid);
</span><del>-emailCheck(&quot;someone@do-.com&quot;, &quot;someone@do-.com&quot;, expectValid);
-emailCheck(&quot;somebody@-.com&quot;, &quot;somebody@-.com&quot;, expectValid);
</del><span class="cx"> emailCheck(&quot;somebody@example&quot;, &quot;somebody@example&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;\u000Aa@p.com\u000A&quot;, &quot;a@p.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;\u000Da@p.com\u000D&quot;, &quot;a@p.com&quot;, expectValid);
</span><span class="lines">@@ -56,6 +53,8 @@
</span><span class="cx"> emailCheck(&quot;\u0020a@p.com\u0020&quot;, &quot;a@p.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;\u0009a@p.com\u0009&quot;, &quot;a@p.com&quot;, expectValid);
</span><span class="cx"> emailCheck(&quot;\u000Ca@p.com\u000C&quot;, &quot;a@p.com&quot;, expectValid);
</span><ins>+emailCheck(&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot;, &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot;, expectValid); // 64 characters in left part.
+emailCheck(&quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, &quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, expectValid); // Labels with 63 characters.
</ins><span class="cx"> 
</span><span class="cx"> debug(&quot;Invalid single addresses when 'multiple' attribute is not set.&quot;);
</span><span class="cx"> emailCheck(&quot;invalid:email@example.com&quot;, &quot;invalid:email@example.com&quot;, expectInvalid);
</span><span class="lines">@@ -81,6 +80,11 @@
</span><span class="cx"> emailCheck(&quot;a\u000C@p.com&quot;, &quot;a\u000C@p.com&quot;, expectInvalid);
</span><span class="cx"> emailCheck(&quot;a\u2003@p.com&quot;, &quot;a\u2003@p.com&quot;, expectInvalid);
</span><span class="cx"> emailCheck(&quot;a\u3000@p.com&quot;, &quot;a\u3000@p.com&quot;, expectInvalid);
</span><ins>+emailCheck(&quot;ddjk-s-jk@asl-.com&quot;, &quot;ddjk-s-jk@asl-.com&quot;, expectInvalid); // Domain should end with a letter or a digit.
+emailCheck(&quot;someone@do-.com&quot;, &quot;someone@do-.com&quot;, expectInvalid); // Domain should end with a letter or a digit.
+emailCheck(&quot;somebody@-.com&quot;, &quot;somebody@-.com&quot;, expectInvalid); // Domain should start with a letter or a digit.
+emailCheck(&quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot;, &quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot;, expectInvalid); // Label with 64 characters.
+emailCheck(&quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, &quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, expectInvalid); // Label with 64 characters.
</ins><span class="cx"> 
</span><span class="cx"> debug(&quot;Valid single addresses when 'multiple' attribute is set.&quot;);
</span><span class="cx"> emailCheck(&quot;something@something.com&quot;, &quot;something@something.com&quot;, expectValid, multiple);
</span><span class="lines">@@ -89,7 +93,6 @@
</span><span class="cx"> emailCheck(&quot;a@b.b&quot;, &quot;a@b.b&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;a/b@domain.com&quot;, &quot;a/b@domain.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;{}@domain.com&quot;, &quot;{}@domain.com&quot;, expectValid, multiple);
</span><del>-emailCheck(&quot;ddjk-s-jk@asl-.com&quot;, &quot;ddjk-s-jk@asl-.com&quot;, expectValid, multiple);
</del><span class="cx"> emailCheck(&quot;m*'!%@something.sa&quot;, &quot;m*'!%@something.sa&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;tu!!7n7.ad##0!!!@company.ca&quot;, &quot;tu!!7n7.ad##0!!!@company.ca&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;%@com.com&quot;, &quot;%@com.com&quot;, expectValid, multiple);
</span><span class="lines">@@ -97,8 +100,6 @@
</span><span class="cx"> emailCheck(&quot;.wooly@example.com&quot;, &quot;.wooly@example.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;wo..oly@example.com&quot;, &quot;wo..oly@example.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;someone@do-ma-in.com&quot;, &quot;someone@do-ma-in.com&quot;, expectValid, multiple);
</span><del>-emailCheck(&quot;someone@do-.com&quot;, &quot;someone@do-.com&quot;, expectValid, multiple);
-emailCheck(&quot;somebody@-.com&quot;, &quot;somebody@-.com&quot;, expectValid, multiple);
</del><span class="cx"> emailCheck(&quot;somebody@example&quot;, &quot;somebody@example&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;\u0020a@p.com\u0020&quot;, &quot;a@p.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;\u0009a@p.com\u0009&quot;, &quot;a@p.com&quot;, expectValid, multiple);
</span><span class="lines">@@ -112,6 +113,8 @@
</span><span class="cx"> emailCheck(&quot; a@p.com&quot;, &quot;a@p.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot;a@p.com &quot;, &quot;a@p.com&quot;, expectValid, multiple);
</span><span class="cx"> emailCheck(&quot; a@p.com &quot;, &quot;a@p.com&quot;, expectValid, multiple);
</span><ins>+emailCheck(&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot;, &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@p.com&quot;, expectValid, multiple); // 64 characters in left part.
+emailCheck(&quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, &quot;a@ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, expectValid, multiple); // Labels with 63 characters.
</ins><span class="cx"> 
</span><span class="cx"> debug(&quot;Invalid single addresses when 'multiple' attribute is set.&quot;);
</span><span class="cx"> emailCheck(&quot;invalid:email@example.com&quot;, &quot;invalid:email@example.com&quot;, expectInvalid, multiple);
</span><span class="lines">@@ -140,6 +143,11 @@
</span><span class="cx"> emailCheck(&quot;a\u000C@p.com&quot;, &quot;a\u000C@p.com&quot;, expectInvalid, multiple);
</span><span class="cx"> emailCheck(&quot;a\u2003@p.com&quot;, &quot;a\u2003@p.com&quot;, expectInvalid, multiple);
</span><span class="cx"> emailCheck(&quot;a\u3000@p.com&quot;, &quot;a\u3000@p.com&quot;, expectInvalid, multiple);
</span><ins>+emailCheck(&quot;ddjk-s-jk@asl-.com&quot;, &quot;ddjk-s-jk@asl-.com&quot;, expectInvalid, multiple); // Domain should end with a letter or a digit.
+emailCheck(&quot;someone@do-.com&quot;, &quot;someone@do-.com&quot;, expectInvalid, multiple); // Domain should end with a letter or a digit.
+emailCheck(&quot;somebody@-.com&quot;, &quot;somebody@-.com&quot;, expectInvalid, multiple); // Domain should start with a letter or a digit.
+emailCheck(&quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot;, &quot;a@pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp.com&quot;, expectInvalid, multiple); // Label with 64 characters.
+emailCheck(&quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, &quot;a@p.cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc&quot;, expectInvalid, multiple); // Label with 64 characters.
</ins><span class="cx"> 
</span><span class="cx"> debug(&quot;Valid multiple addresses when 'multiple' attribute is set.&quot;);
</span><span class="cx"> emailCheck(&quot;someone@somewhere.com,john@doe.com,a@b.c,a/b@c.c,ualla@ualla.127&quot;, &quot;someone@somewhere.com,john@doe.com,a@b.c,a/b@c.c,ualla@ualla.127&quot;, expectValid, multiple);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210360 => 210361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-05 18:29:00 UTC (rev 210360)
+++ trunk/Source/WebCore/ChangeLog        2017-01-05 18:31:27 UTC (rev 210361)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-01-05  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Form validation: Align email validation with the latest HTML specification
+        https://bugs.webkit.org/show_bug.cgi?id=166697
+        &lt;rdar://problem/29870245&gt;
+
+        Reviewed by Alex Christensen.
+
+        Align email validation with the latest HTML specification:
+        - https://html.spec.whatwg.org/#valid-e-mail-address
+
+        It particular, the following changes were made:
+        - The first and last character of the domain now needs to be a letter or a digit
+        - Parts of the domain can only be 63 characters in length
+
+        No new tests, extended existing test.
+
+        * html/EmailInputType.cpp:
+
</ins><span class="cx"> 2017-01-05  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support File Promise during drag for macOS.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlEmailInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/EmailInputType.cpp (210360 => 210361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/EmailInputType.cpp        2017-01-05 18:29:00 UTC (rev 210360)
+++ trunk/Source/WebCore/html/EmailInputType.cpp        2017-01-05 18:31:27 UTC (rev 210361)
</span><span class="lines">@@ -34,10 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static const char emailPattern[] =
-    &quot;[a-z0-9!#$%&amp;'*+/=?^_`{|}~.-]+&quot; // local part
-    &quot;@&quot;
-    &quot;[a-z0-9-]+(\\.[a-z0-9-]+)*&quot;; // domain part
</del><ins>+// From https://html.spec.whatwg.org/#valid-e-mail-address.
+static const char emailPattern[] = &quot;^[a-zA-Z0-9.!#$%&amp;'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$&quot;;
</ins><span class="cx"> 
</span><span class="cx"> static bool isValidEmailAddress(const String&amp; address)
</span><span class="cx"> {
</span></span></pre>
</div>
</div>

</body>
</html>