Skip to content

Commit

Permalink
Bulgarian TLD should not punycode-encode URLs with Bulgarian Cyrillic…
Browse files Browse the repository at this point in the history
… characters

https://bugs.webkit.org/show_bug.cgi?id=193411
<rdar://problem/47215929>

Reviewed by Alexey Proskuryakov.

Source/WTF:

* wtf/cocoa/NSURLExtras.mm:
(WTF::allCharactersAllowedByTLDRules):

LayoutTests:

* fast/url/user-visible/cyrillic-NFD-expected.txt:
* fast/url/user-visible/cyrillic-NFD.html:



Canonical link: https://commits.webkit.org/207936@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
achristensen07 committed Jan 15, 2019
1 parent 7a846ab commit 0a23b9b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
2019-01-14 Alex Christensen <achristensen@webkit.org>

Bulgarian TLD should not punycode-encode URLs with Bulgarian Cyrillic characters
https://bugs.webkit.org/show_bug.cgi?id=193411
<rdar://problem/47215929>

Reviewed by Alexey Proskuryakov.

* fast/url/user-visible/cyrillic-NFD-expected.txt:
* fast/url/user-visible/cyrillic-NFD.html:

2019-01-14 John Wilander <wilander@apple.com>

Restructure http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html to address flakiness
Expand Down
5 changes: 5 additions & 0 deletions LayoutTests/fast/url/user-visible/cyrillic-NFD-expected.txt
Expand Up @@ -5,6 +5,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE

PASS test('http://спецодежда.онлайн/') is 'http://спецодежда.онлайн/'
PASS test('http://спецодежда.онлайн/') is 'http://спецодежда.онлайн/'
PASS test('http://ж1-2.бг/') is 'http://ж1-2.бг/'
PASS test('http://жabc.бг/') is 'http://xn--abc-udd.xn--90ae/'
PASS test('http://abc.бг/') is 'http://abc.xn--90ae/'
PASS test('http://ы.бг/') is 'http://xn--01a.xn--90ae/'
PASS test('http://э.бг/') is 'http://xn--21a.xn--90ae/'
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
5 changes: 5 additions & 0 deletions LayoutTests/fast/url/user-visible/cyrillic-NFD.html
Expand Up @@ -17,6 +17,11 @@

shouldBe("test('http://спецодежда.онла\u0439н/')", "'http://спецодежда.онлайн/'");
shouldBe("test('http://спецодежда.онла\u0438\u0306н/')", "'http://спецодежда.онлайн/'");
shouldBe("test('http://ж1-2.бг/')", "'http://ж1-2.бг/'");
shouldBe("test('http://жabc.бг/')", "'http://xn--abc-udd.xn--90ae/'");
shouldBe("test('http://abc.бг/')", "'http://abc.xn--90ae/'");
shouldBe("test('http://ы.бг/')", "'http://xn--01a.xn--90ae/'");
shouldBe("test('http://э.бг/')", "'http://xn--21a.xn--90ae/'");

</script>
<script src="../../../resources/js-test-post.js"></script>
Expand Down
11 changes: 11 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,14 @@
2019-01-14 Alex Christensen <achristensen@webkit.org>

Bulgarian TLD should not punycode-encode URLs with Bulgarian Cyrillic characters
https://bugs.webkit.org/show_bug.cgi?id=193411
<rdar://problem/47215929>

Reviewed by Alexey Proskuryakov.

* wtf/cocoa/NSURLExtras.mm:
(WTF::allCharactersAllowedByTLDRules):

2019-01-12 Timothy Hatcher <timothy@apple.com>

Have prefers-color-scheme: light always match on macOS versions before Mojave.
Expand Down
10 changes: 10 additions & 0 deletions Source/WTF/wtf/cocoa/NSURLExtras.mm
Expand Up @@ -540,6 +540,16 @@ static BOOL allCharactersAllowedByTLDRules(const UChar* buffer, int32_t length)
return (ch >= 0x0430 && ch <= 0x044f) || ch == 0x0451 || ch == 0x04E9 || ch == 0x04AF || isASCIIDigit(ch) || ch == '-';
});

// https://www.icann.org/sites/default/files/packages/lgr/lgr-second-level-bulgarian-30aug16-en.html
static const UChar cyrillicBG[] = {
'.',
0x0431, // CYRILLIC SMALL LETTER BE
0x0433 // CYRILLIC SMALL LETTER GHE
};
CHECK_RULES_IF_SUFFIX_MATCHES(cyrillicBG, [](UChar ch) {
return (ch >= 0x0430 && ch <= 0x044A) || ch == 0x044C || (ch >= 0x044E && ch <= 0x0450) || ch == 0x045D || isASCIIDigit(ch) || ch == '-';
});

// Not a known top level domain with special rules.
return NO;
}
Expand Down

0 comments on commit 0a23b9b

Please sign in to comment.