Show punycode if URL contains hyphen character
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2018 02:04:05 +0000 (02:04 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2018 02:04:05 +0000 (02:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184221
<rdar://problem/38044633>

Reviewed by Darin Adler.

Source/WebCore:

Revise our "lookalike character" logic to include the hyphen,
non-breaking hyphen, and minus sign.

Test: fast/url/host.html

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::isLookalikeCharacter):

LayoutTests:

* fast/url/host-expected.txt:
* fast/url/host.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230146 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/url/host-expected.txt
LayoutTests/fast/url/host.html
Source/WebCore/ChangeLog
Source/WebCore/platform/mac/WebCoreNSURLExtras.mm

index 833f9d4..0c08b1e 100644 (file)
@@ -1,3 +1,14 @@
+2018-03-31  Brent Fulgham  <bfulgham@apple.com>
+
+        Show punycode if URL contains hyphen character
+        https://bugs.webkit.org/show_bug.cgi?id=184221
+        <rdar://problem/38044633>
+
+        Reviewed by Darin Adler.
+
+        * fast/url/host-expected.txt:
+        * fast/url/host.html:
+
 2018-03-30  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: tint all pixels drawn by shader program when hovering ShaderProgramTreeElement
index 53975c9..3739272 100644 (file)
@@ -44,6 +44,9 @@ PASS canonicalize('http://xxxx:/') is 'http://xxxx/'
 PASS canonicalize('http://.:./') is 'http://.:./'
 PASS canonicalize('http://////@google.com//') is 'http://google.com//'
 PASS canonicalize('http://@google.com/') is 'http://google.com/'
+PASS canonicalize('http://quip‐apple.com/') is 'http://xn--quipapple-y79d.com/'
+PASS canonicalize('http://quip‑apple.com/') is 'http://xn--quipapple-y79d.com/'
+PASS canonicalize('http://quip−apple.com/') is 'http://xn--quipapple-tf4e.com/'
 PASS successfullyParsed is true
 
 TEST COMPLETE
index cb7e5a3..251f3fd 100644 (file)
@@ -84,7 +84,10 @@ cases = [
   ["xxxx:","xxxx"],
   [".:.",".:."],
   ["////@google.com/","google.com/"],
-  ["@google.com","google.com"]
+  ["@google.com","google.com"],
+  ["quip\u2010apple.com", "xn--quipapple-y79d.com"],
+  ["quip\u2011apple.com", "xn--quipapple-y79d.com"],
+  ["quip\u2212apple.com", "xn--quipapple-tf4e.com"]
 ];
 
 for (var i = 0; i < cases.length; ++i) {
index 005ba46..38bd54a 100644 (file)
@@ -1,3 +1,19 @@
+2018-03-31  Brent Fulgham  <bfulgham@apple.com>
+
+        Show punycode if URL contains hyphen character
+        https://bugs.webkit.org/show_bug.cgi?id=184221
+        <rdar://problem/38044633>
+
+        Reviewed by Darin Adler.
+
+        Revise our "lookalike character" logic to include the hyphen,
+        non-breaking hyphen, and minus sign.
+
+        Test: fast/url/host.html
+
+        * platform/mac/WebCoreNSURLExtras.mm:
+        (WebCore::isLookalikeCharacter):
+
 2018-03-31  Filip Pizlo  <fpizlo@apple.com>
 
         JSObject shouldn't do index masking
index bd6776d..cc6c2fa 100644 (file)
@@ -147,6 +147,8 @@ static BOOL isLookalikeCharacter(std::optional<UChar32> previousCodePoint, UChar
         case 0x1D20: /* LATIN LETTER SMALL CAPITAL V */
         case 0x1D21: /* LATIN LETTER SMALL CAPITAL W */
         case 0x1D22: /* LATIN LETTER SMALL CAPITAL Z */
+        case 0x2010: /* HYPHEN */
+        case 0x2011: /* NON-BREAKING HYPHEN */
         case 0x2024: /* ONE DOT LEADER */
         case 0x2027: /* HYPHENATION POINT */
         case 0x2039: /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
@@ -167,6 +169,7 @@ static BOOL isLookalikeCharacter(std::optional<UChar32> previousCodePoint, UChar
         case 0x215D: /* VULGAR FRACTION FIVE EIGHTHS */
         case 0x215E: /* VULGAR FRACTION SEVEN EIGHTHS */
         case 0x215F: /* FRACTION NUMERATOR ONE */
+        case 0x2212: /* MINUS SIGN */
         case 0x2215: /* DIVISION SLASH */
         case 0x2216: /* SET MINUS */
         case 0x2236: /* RATIO */