Bug 29913

Summary: typeMismatch for type=url is not compliant to standards, and incompatible in KURL implementations
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, brettw, commit-queue, darin, fishd, michelangelo, pkasting
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://www.w3.org/html/wg/href/draft
Bug Depends on: 27456    
Bug Blocks: 19264    
Attachments:
Description Flags
Proposed patch none

Description Kent Tamura 2009-09-30 00:01:17 PDT
LayoutTests/fast/forms/ValidityState-typeMismtch-url.html fails on Chromium port because KURL implementation in Chromium is different from other ports, and host name validation rules are mismatched between the normal KURL and Chromium KURL.

> FAIL http://www.g**gle.com is an incorrect valid url.
> FAIL http:// www.google.com is an incorrect valid url.
> FAIL http://www .google.com is an incorrect valid url.
> FAIL http://www.&#10;google.&#13;com is an incorrect valid url.
> FAIL http://host+ is an incorrect valid url.
> FAIL http://myurl! is an incorrect valid url.

The ASCII host name rule in the normal KURL is like:
  HEXDIG = "0-9A-Fa-f"
  KURL_IPV6ADDR = "[" + HEXDIG + ":]+"
  ALPHADIGIT = "0-9A-Za-z"
  KURL_HOST = "¥¥[" + KURL_IPV6ADDR + "]|[-._" + ALPHADIGIT + "]*"

The ASCII host name rule in Chromium KURL, GoogleURL, is like:
  PCT_ENCODED = "%[" + HEXDIG + "]{2}"
  GURL_HOST = "(" + PCT_ENCODED + "|[- !"#$&'()*+,.:<=>@[]_`{|}" + ALPHADIGIT + "])*"

HTML5's URL type is an absolute URI or an absolute IRI.  URI (RFC3986)'s host name rule is like:
  IPV6ADDR = "[" + HEXDIG + ":.]+"
  UD = "-!$&'()*+,.;=_~" + ALPHADIGIT
  IPADDR = "(" + IPV6ADDR + "|v[0-9]¥.[:" + UD + "]+)"
  URI_HOST = "¥¥[" + IPADDR + "]|(" + PCT_ENCODED + "|[" + UD + "])*"


IMO,
 - Changing GoogleURL so that it has the same rules as KURL
 - Changing KURL so that it has the same rules as GoogleURL
 - Changing both of GoogleURL and KURL so that they are compliant to the standards strictly
They DON'T work well because I think KURL and GoogleURL have practical reasons of the non-standard rules.

Should we have dedicated URL validator for <input type=url>?  In that case, how to check IDN validity?
Comment 1 Darin Adler 2009-09-30 10:05:04 PDT
I think we should make KURL’s rules match GoogleURL and then remove the WebCore dependency on GoogleURL entirely. Chromium can continue to use GoogleURL elsewhere, and the Chromium team can add regression tests to make sure KURL is 100% compatible with GoogleURL.
Comment 2 Kent Tamura 2009-10-04 23:40:27 PDT
(In reply to comment #1)
> I think we should make KURL’s rules match GoogleURL and then remove the WebCore
> dependency on GoogleURL entirely. Chromium can continue to use GoogleURL
> elsewhere, and the Chromium team can add regression tests to make sure KURL is
> 100% compatible with GoogleURL.

Chromium guys, why KURLGogole was introduced?  Do we need to use GoogleURL in the renderer process?
Comment 3 Kent Tamura 2009-11-25 23:19:48 PST
I heard Chromium wanted to keep KURLGoogle for consistency with non-WebKit part.  So I'll change the test to support both of KURL and KURLGoogle.
Comment 4 Kent Tamura 2009-11-25 23:23:19 PST
Created attachment 43897 [details]
Proposed patch
Comment 5 Adam Barth 2009-11-30 12:42:52 PST
style-queue ran check-webkit-style on attachment 43897 [details] without any errors.
Comment 6 Darin Adler 2009-12-07 10:29:04 PST
Comment on attachment 43897 [details]
Proposed patch

> +// KURL's host name restriction is stricter than RFC 3986. KURLGoogle is not.

It would be best to make these the same. It's not good to have incompatible dialects of WebKit!

r=me
Comment 7 WebKit Commit Bot 2009-12-07 14:50:23 PST
Comment on attachment 43897 [details]
Proposed patch

Clearing flags on attachment: 43897

Committed r51799: <http://trac.webkit.org/changeset/51799>
Comment 8 WebKit Commit Bot 2009-12-07 14:50:29 PST
All reviewed patches have been landed.  Closing bug.