Diff
Modified: branches/safari-609-branch/LayoutTests/ChangeLog (254614 => 254615)
--- branches/safari-609-branch/LayoutTests/ChangeLog 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/LayoutTests/ChangeLog 2020-01-15 19:16:08 UTC (rev 254615)
@@ -1,3 +1,149 @@
+2020-01-15 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r254389. rdar://problem/58548648
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+ Source/WTF:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip
+ it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo().
+ This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47
+ language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting
+ turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used
+ in this way.
+
+ Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to
+ canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves
+ more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to
+ minimize the entropy revealed.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Language.h:
+ * wtf/Platform.h:
+ * wtf/PlatformMac.cmake:
+ * wtf/cf/LanguageCF.cpp:
+ (WTF::httpStyleLanguageCode):
+ (WTF::platformUserPreferredLanguages):
+ * wtf/cocoa/LanguageCocoa.mm: Added.
+ (WTF::minimizedLanguagesFromLanguages):
+ * wtf/spi/cocoa/NSLocaleSPI.h: Added.
+
+ Tools:
+
+ Reviewed by Dean Jackson.
+
+ Migrate system language tests to LayoutTests, to match the rest of our system language tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: Removed.
+
+ LayoutTests:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ Migrate and update tests from TestWebKitAPI to LayoutTests, to match the rest of our system language tests.
+
+ * platform/mac/TestExpectations: Mark these tests as possibly failing on older versions of macOS.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: Added.
+ * js/dom/navigator-language-expected.txt:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-01-10 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ Migrate and update tests from TestWebKitAPI to LayoutTests, to match the rest of our system language tests.
+
+ * platform/mac/TestExpectations: Mark these tests as possibly failing on older versions of macOS.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: Added.
+ * js/dom/navigator-language-expected.txt:
+
2020-01-14 Alan Coon <alanc...@apple.com>
Cherry-pick r254322. rdar://problem/58549088
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "en-gb"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=en-GB ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "en-gb");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "en"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-US.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=en-US ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "en");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "en"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=en ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "en");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "es-419"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-419.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=es-419 ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "es-419");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "es"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-ES.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=es-ES ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "es");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "es-419"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-MX.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=es-MX ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "es-419");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "es"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-es.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=es ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "es");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "fr-ca"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=fr-CA ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "fr-ca");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "fr"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-fr.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=fr ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "fr");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "hi"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-hi.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=hi ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "hi");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "ja"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ja.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=ja ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "ja");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "pt"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=pt-BR ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "pt");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "pt-pt"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=pt-PT ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "pt-pt");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "ru"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-ru.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=ru ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "ru");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "zh-hk"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=zh-HK ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "zh-hk");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "zh-cn"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=zh-Hans ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "zh-cn");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "zh-hk"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=zh-Hant-HK ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "zh-hk");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "zh-tw"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=zh-Hant ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "zh-tw");
+</script>
+<script src=""
+</body>
+</html>
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,5 @@
+PASS navigator.language is "zh-tw"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html (0 => 254615)
--- branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=zh-TW ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("navigator.language", "zh-tw");
+</script>
+<script src=""
+</body>
+</html>
Modified: branches/safari-609-branch/LayoutTests/js/dom/navigator-language-expected.txt (254614 => 254615)
--- branches/safari-609-branch/LayoutTests/js/dom/navigator-language-expected.txt 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/LayoutTests/js/dom/navigator-language-expected.txt 2020-01-15 19:16:08 UTC (rev 254615)
@@ -2,7 +2,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS language is 'en-US'
+PASS
PASS successfullyParsed is true
TEST COMPLETE
Modified: branches/safari-609-branch/LayoutTests/js/dom/navigator-language.html (254614 => 254615)
--- branches/safari-609-branch/LayoutTests/js/dom/navigator-language.html 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/LayoutTests/js/dom/navigator-language.html 2020-01-15 19:16:08 UTC (rev 254615)
@@ -15,10 +15,10 @@
}
var language = navigator.language;
-if (language.length == 2)
- shouldBe("language", "'en'");
+if (language == "en" || language == "en-us" || language == "en-US")
+ testPassed("");
else
- shouldBe("language", "'en-US'");
+ testFailed("");
</script>
<script src=""
</body>
Modified: branches/safari-609-branch/LayoutTests/platform/mac/TestExpectations (254614 => 254615)
--- branches/safari-609-branch/LayoutTests/platform/mac/TestExpectations 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/LayoutTests/platform/mac/TestExpectations 2020-01-15 19:16:08 UTC (rev 254615)
@@ -1967,3 +1967,5 @@
webkit.org/b/205757 webgl/1.0.3/conformance/textures/texture-upload-size.html [ Pass Timeout ]
+# The navigator.language tests rely on functionality only available in recent releases of macOS Catalina and onward.
+webkit.org/b/200043 [ Sierra HighSierra Mojave ] fast/text/international/system-language/navigator-language [ Pass Failure ]
Modified: branches/safari-609-branch/Source/WTF/ChangeLog (254614 => 254615)
--- branches/safari-609-branch/Source/WTF/ChangeLog 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Source/WTF/ChangeLog 2020-01-15 19:16:08 UTC (rev 254615)
@@ -1,3 +1,129 @@
+2020-01-15 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r254389. rdar://problem/58548648
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+ Source/WTF:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip
+ it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo().
+ This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47
+ language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting
+ turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used
+ in this way.
+
+ Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to
+ canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves
+ more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to
+ minimize the entropy revealed.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Language.h:
+ * wtf/Platform.h:
+ * wtf/PlatformMac.cmake:
+ * wtf/cf/LanguageCF.cpp:
+ (WTF::httpStyleLanguageCode):
+ (WTF::platformUserPreferredLanguages):
+ * wtf/cocoa/LanguageCocoa.mm: Added.
+ (WTF::minimizedLanguagesFromLanguages):
+ * wtf/spi/cocoa/NSLocaleSPI.h: Added.
+
+ Tools:
+
+ Reviewed by Dean Jackson.
+
+ Migrate system language tests to LayoutTests, to match the rest of our system language tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: Removed.
+
+ LayoutTests:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ Migrate and update tests from TestWebKitAPI to LayoutTests, to match the rest of our system language tests.
+
+ * platform/mac/TestExpectations: Mark these tests as possibly failing on older versions of macOS.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: Added.
+ * js/dom/navigator-language-expected.txt:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-01-10 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip
+ it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo().
+ This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47
+ language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting
+ turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used
+ in this way.
+
+ Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to
+ canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves
+ more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to
+ minimize the entropy revealed.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Language.h:
+ * wtf/Platform.h:
+ * wtf/PlatformMac.cmake:
+ * wtf/cf/LanguageCF.cpp:
+ (WTF::httpStyleLanguageCode):
+ (WTF::platformUserPreferredLanguages):
+ * wtf/cocoa/LanguageCocoa.mm: Added.
+ (WTF::minimizedLanguagesFromLanguages):
+ * wtf/spi/cocoa/NSLocaleSPI.h: Added.
+
2020-01-03 Dean Jackson <d...@apple.com>
[WebGL] Enable ANGLE by default for Cocoa platforms (except simulator)
Modified: branches/safari-609-branch/Source/WTF/WTF.xcodeproj/project.pbxproj (254614 => 254615)
--- branches/safari-609-branch/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-01-15 19:16:08 UTC (rev 254615)
@@ -60,6 +60,7 @@
1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C8B1D307AB800F5FA16 /* UTextProviderLatin1.cpp */; };
1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C8D1D307AB800F5FA16 /* UTextProviderUTF16.cpp */; };
1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */; };
+ 1C503BE623AAE0AE0072E66B /* LanguageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */; };
1FA47C8A152502DA00568D1B /* WebCoreThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FA47C88152502DA00568D1B /* WebCoreThread.cpp */; };
2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
@@ -339,6 +340,8 @@
1C181C8D1D307AB800F5FA16 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; };
1C181C8E1D307AB800F5FA16 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorInternalICUCocoa.cpp; sourceTree = "<group>"; };
+ 1C503BE423AADEEA0072E66B /* NSLocaleSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSLocaleSPI.h; sourceTree = "<group>"; };
+ 1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LanguageCocoa.mm; sourceTree = "<group>"; };
1CCDB1491E566626006C73C0 /* TextBreakIteratorCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorCF.h; sourceTree = "<group>"; };
1CCDB14D1E566898006C73C0 /* TextBreakIteratorICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorICU.h; sourceTree = "<group>"; };
1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFStringSPI.h; sourceTree = "<group>"; };
@@ -1412,6 +1415,7 @@
9384B73E20DEA284005B73B2 /* CFXPCBridgeSPI.h */,
CEA072A7236FFA160018839C /* CrashReporterClientSPI.h */,
E31BDE2822E913CC0029B105 /* MachVMSPI.h */,
+ 1C503BE423AADEEA0072E66B /* NSLocaleSPI.h */,
93D191CF20CAECE800C51B8E /* objcSPI.h */,
A5098B011C16A4F900087797 /* SecuritySPI.h */,
);
@@ -1475,6 +1479,7 @@
143DDE9720C8BE99007F76FA /* Entitlements.h */,
143DDE9520C8BC37007F76FA /* Entitlements.mm */,
A331D95E21F249F6009F02AA /* FileSystemCocoa.mm */,
+ 1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */,
7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */,
A8A472C5151A825A004123FF /* MainThreadCocoa.mm */,
ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */,
@@ -1621,6 +1626,7 @@
E3A32BC41FC830E2007D7E76 /* JSValueMalloc.cpp in Sources */,
C2BCFC401F61D13000C9222C /* Language.cpp in Sources */,
C2BCFC421F61D61600C9222C /* LanguageCF.cpp in Sources */,
+ 1C503BE623AAE0AE0072E66B /* LanguageCocoa.mm in Sources */,
C2BCFC551F621F3F00C9222C /* LineEnding.cpp in Sources */,
0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */,
0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */,
Modified: branches/safari-609-branch/Source/WTF/wtf/Language.h (254614 => 254615)
--- branches/safari-609-branch/Source/WTF/wtf/Language.h 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Source/WTF/wtf/Language.h 2020-01-15 19:16:08 UTC (rev 254615)
@@ -28,6 +28,11 @@
#include <wtf/Forward.h>
#include <wtf/Vector.h>
+#if PLATFORM(COCOA)
+#import <CoreFoundation/CoreFoundation.h>
+#import <wtf/RetainPtr.h>
+#endif
+
namespace WTF {
WTF_EXPORT String defaultLanguage(); // Thread-safe.
@@ -43,8 +48,13 @@
typedef void (*LanguageChangeObserverFunction)(void* context);
WTF_EXPORT void addLanguageChangeObserver(void* context, LanguageChangeObserverFunction);
WTF_EXPORT void removeLanguageChangeObserver(void* context);
+WTF_EXPORT String displayNameForLanguageLocale(const String&);
-WTF_EXPORT String displayNameForLanguageLocale(const String&);
+#if PLATFORM(COCOA)
+bool canMinimizeLanguages();
+RetainPtr<CFArrayRef> minimizedLanguagesFromLanguages(CFArrayRef);
+#endif
+
}
using WTF::defaultLanguage;
Modified: branches/safari-609-branch/Source/WTF/wtf/PlatformMac.cmake (254614 => 254615)
--- branches/safari-609-branch/Source/WTF/wtf/PlatformMac.cmake 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Source/WTF/wtf/PlatformMac.cmake 2020-01-15 19:16:08 UTC (rev 254615)
@@ -26,6 +26,7 @@
spi/cocoa/CFXPCBridgeSPI.h
spi/cocoa/CrashReporterClientSPI.h
spi/cocoa/MachVMSPI.h
+ spi/cocoa/NSLocaleSPI.h
spi/cocoa/SecuritySPI.h
spi/cocoa/objcSPI.h
@@ -56,6 +57,7 @@
cocoa/CrashReporter.cpp
cocoa/Entitlements.mm
cocoa/FileSystemCocoa.mm
+ cocoa/LanguageCocoa.mm
cocoa/MachSendRight.cpp
cocoa/MainThreadCocoa.mm
cocoa/MemoryFootprintCocoa.cpp
Modified: branches/safari-609-branch/Source/WTF/wtf/cf/LanguageCF.cpp (254614 => 254615)
--- branches/safari-609-branch/Source/WTF/wtf/cf/LanguageCF.cpp 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Source/WTF/wtf/cf/LanguageCF.cpp 2020-01-15 19:16:08 UTC (rev 254615)
@@ -48,28 +48,35 @@
static String httpStyleLanguageCode(CFStringRef language)
{
- SInt32 languageCode;
- SInt32 regionCode;
- SInt32 scriptCode;
- CFStringEncoding stringEncoding;
+ RetainPtr<CFStringRef> preferredLanguageCode;
+ // If we can minimize the language list to reduce fingerprinting, we can afford to be more lossless when canonicalizing the locale list.
+ if (canMinimizeLanguages())
+ preferredLanguageCode = adoptCF(CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, language));
+ else {
+ SInt32 languageCode;
+ SInt32 regionCode;
+ SInt32 scriptCode;
+ CFStringEncoding stringEncoding;
- // FIXME: This transformation is very wrong:
- // 1. There is no reason why CFBundle localization names would be at all related to language names as used on the Web.
- // 2. Script Manager codes cannot represent all languages that are now supported by the platform, so the conversion is lossy.
- // 3. This should probably match what is sent by the network layer as Accept-Language, but currently, that's implemented separately.
- CFBundleGetLocalizationInfoForLocalization(language, &languageCode, ®ionCode, &scriptCode, &stringEncoding);
- RetainPtr<CFStringRef> preferredLanguageCode = adoptCF(CFBundleCopyLocalizationForLocalizationInfo(languageCode, regionCode, scriptCode, stringEncoding));
- if (preferredLanguageCode)
- language = preferredLanguageCode.get();
+ // FIXME: This transformation is very wrong:
+ // 1. There is no reason why CFBundle localization names would be at all related to language names as used on the Web.
+ // 2. Script Manager codes cannot represent all languages that are now supported by the platform, so the conversion is lossy.
+ // 3. This should probably match what is sent by the network layer as Accept-Language, but currently, that's implemented separately.
+ CFBundleGetLocalizationInfoForLocalization(language, &languageCode, ®ionCode, &scriptCode, &stringEncoding);
+ preferredLanguageCode = adoptCF(CFBundleCopyLocalizationForLocalizationInfo(languageCode, regionCode, scriptCode, stringEncoding));
+ }
+ if (!preferredLanguageCode)
+ preferredLanguageCode = language;
+ auto mutableLanguageCode = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, preferredLanguageCode.get()));
+
// Turn a '_' into a '-' if it appears after a 2-letter language code
- if (CFStringGetLength(language) >= 3 && CFStringGetCharacterAtIndex(language, 2) == '_') {
- auto mutableLanguageCode = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, language));
+ if (CFStringGetLength(mutableLanguageCode.get()) >= 3 && CFStringGetCharacterAtIndex(mutableLanguageCode.get(), 2) == '_')
CFStringReplace(mutableLanguageCode.get(), CFRangeMake(2, 1), CFSTR("-"));
- return mutableLanguageCode.get();
- }
- return language;
+ CFStringLowercase(mutableLanguageCode.get(), nullptr);
+ return mutableLanguageCode.get();
+
}
#if PLATFORM(MAC)
@@ -98,6 +105,7 @@
if (userPreferredLanguages.isEmpty()) {
RetainPtr<CFArrayRef> languages = adoptCF(CFLocaleCopyPreferredLanguages());
+ languages = minimizedLanguagesFromLanguages(languages.get());
CFIndex languageCount = CFArrayGetCount(languages.get());
if (!languageCount)
userPreferredLanguages.append("en");
Added: branches/safari-609-branch/Source/WTF/wtf/cocoa/LanguageCocoa.mm (0 => 254615)
--- branches/safari-609-branch/Source/WTF/wtf/cocoa/LanguageCocoa.mm (rev 0)
+++ branches/safari-609-branch/Source/WTF/wtf/cocoa/LanguageCocoa.mm 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import <wtf/Language.h>
+
+#import <wtf/NeverDestroyed.h>
+#import <wtf/spi/cocoa/NSLocaleSPI.h>
+
+namespace WTF {
+
+bool canMinimizeLanguages()
+{
+ static NeverDestroyed<bool> result = [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
+ return result.get();
+}
+
+RetainPtr<CFArrayRef> minimizedLanguagesFromLanguages(CFArrayRef languages)
+{
+ if (!canMinimizeLanguages())
+ return languages;
+
+ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN
+ return (__bridge CFArrayRef)[NSLocale minimizedLanguagesFromLanguages:(__bridge NSArray<NSString *> *)languages];
+ALLOW_NEW_API_WITHOUT_GUARDS_END
+}
+
+}
Added: branches/safari-609-branch/Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h (0 => 254615)
--- branches/safari-609-branch/Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h (rev 0)
+++ branches/safari-609-branch/Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h 2020-01-15 19:16:08 UTC (rev 254615)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+#if PLATFORM(MAC) && USE(APPLE_INTERNAL_SDK)
+
+#import <InternationalSupport/NSLocale+InternationalSupportExtensions.h>
+
+#else
+
+@interface NSLocale ()
++ (nonnull NSArray<NSString *> *)minimizedLanguagesFromLanguages:(nonnull NSArray<NSString *> *)languages;
+@end
+
+#endif
Modified: branches/safari-609-branch/Tools/ChangeLog (254614 => 254615)
--- branches/safari-609-branch/Tools/ChangeLog 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Tools/ChangeLog 2020-01-15 19:16:08 UTC (rev 254615)
@@ -1,3 +1,110 @@
+2020-01-15 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r254389. rdar://problem/58548648
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+ Source/WTF:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip
+ it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo().
+ This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47
+ language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting
+ turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used
+ in this way.
+
+ Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to
+ canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves
+ more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to
+ minimize the entropy revealed.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Language.h:
+ * wtf/Platform.h:
+ * wtf/PlatformMac.cmake:
+ * wtf/cf/LanguageCF.cpp:
+ (WTF::httpStyleLanguageCode):
+ (WTF::platformUserPreferredLanguages):
+ * wtf/cocoa/LanguageCocoa.mm: Added.
+ (WTF::minimizedLanguagesFromLanguages):
+ * wtf/spi/cocoa/NSLocaleSPI.h: Added.
+
+ Tools:
+
+ Reviewed by Dean Jackson.
+
+ Migrate system language tests to LayoutTests, to match the rest of our system language tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: Removed.
+
+ LayoutTests:
+
+ <rdar://problem/44119496>
+
+ Reviewed by Dean Jackson.
+
+ Migrate and update tests from TestWebKitAPI to LayoutTests, to match the rest of our system language tests.
+
+ * platform/mac/TestExpectations: Mark these tests as possibly failing on older versions of macOS.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-en.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-es.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-fr.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-hi.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ja.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-ru.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt: Added.
+ * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: Added.
+ * js/dom/navigator-language-expected.txt:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-01-10 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
+ https://bugs.webkit.org/show_bug.cgi?id=200043
+
+ Reviewed by Dean Jackson.
+
+ Migrate system language tests to LayoutTests, to match the rest of our system language tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: Removed.
+
2020-01-14 Alan Coon <alanc...@apple.com>
Cherry-pick r254344. rdar://problem/58559189
Modified: branches/safari-609-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (254614 => 254615)
--- branches/safari-609-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-01-15 19:16:08 UTC (rev 254615)
@@ -375,7 +375,6 @@
5C0BF8921DD599B600B00328 /* EarlyKVOCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9FB6CC1CA34BE500966124 /* EarlyKVOCrash.mm */; };
5C0BF8931DD599BD00B00328 /* IsNavigationActionTrusted.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */; };
5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A99D9931AD4A29D00373141 /* MenuTypesForMouseEvents.mm */; };
- 5C0BF8951DD599CD00B00328 /* NavigatorLanguage.mm in Sources */ = {isa = PBXBuildFile; fileRef = E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */; };
5C16F8FC230C94370074C4A8 /* TextSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C16F8FB230C942B0074C4A8 /* TextSize.mm */; };
5C19A5241FD0F60100EEA323 /* CookiePrivateBrowsing.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C19A5231FD0F32600EEA323 /* CookiePrivateBrowsing.mm */; };
5C23DF0B2246015800F454B6 /* Challenge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C23DF0A2245C9D700F454B6 /* Challenge.mm */; };
@@ -2494,7 +2493,6 @@
E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StopLoadingFromDidReceiveResponse.mm; sourceTree = "<group>"; };
E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = StopLoadingFromDidReceiveResponse.html; sourceTree = "<group>"; };
- E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NavigatorLanguage.mm; sourceTree = "<group>"; };
E32B549122810AC0008AD702 /* Packed.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Packed.cpp; sourceTree = "<group>"; };
E35FC7B122B82A6D00F32F98 /* JSLockTakesWebThreadLock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSLockTakesWebThreadLock.mm; sourceTree = "<group>"; };
E388887020C9098100E632BC /* WorkerPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerPool.cpp; sourceTree = "<group>"; };
@@ -4001,7 +3999,6 @@
517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */,
5C0BF88C1DD5957400B00328 /* MemoryPressureHandler.mm */,
7A99D9931AD4A29D00373141 /* MenuTypesForMouseEvents.mm */,
- E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */,
83F22C6320B355EB0034277E /* NoPolicyDelegateResponse.mm */,
A57A34EF16AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm */,
37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */,
@@ -4771,7 +4768,6 @@
7CCE7F011A411AE600447C4C /* MouseMoveAfterCrash.cpp in Sources */,
7CCE7F241A411AF600447C4C /* Navigation.mm in Sources */,
6351992822275C6A00890AD3 /* NavigationAction.mm in Sources */,
- 5C0BF8951DD599CD00B00328 /* NavigatorLanguage.mm in Sources */,
5C8BC799218CF44700813886 /* NetworkProcess.mm in Sources */,
5CAE463820193B6A0051610F /* NetworkProcessCrashNonPersistentDataStore.mm in Sources */,
9B19CDA01F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm in Sources */,
Deleted: branches/safari-609-branch/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm (254614 => 254615)
--- branches/safari-609-branch/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm 2020-01-15 19:15:58 UTC (rev 254614)
+++ branches/safari-609-branch/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm 2020-01-15 19:16:08 UTC (rev 254615)
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "PlatformUtilities.h"
-#import <WebKit/WebViewPrivate.h>
-#import <WebKit/DOM.h>
-#import <wtf/RetainPtr.h>
-
-@interface NavigatorLanguageDelegate : NSObject <WebFrameLoadDelegate> {
-}
-@end
-
-static bool didFinishLoad;
-
-@implementation NavigatorLanguageDelegate
-
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
-{
- didFinishLoad = true;
-}
-
-@end
-
-namespace TestWebKitAPI {
-
-void overrideAppleLanguages(NSString *primaryLanguage)
-{
- RetainPtr<NSMutableDictionary> argumentDomain = adoptNS([[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy]);
- if (!argumentDomain)
- argumentDomain = adoptNS([[NSMutableDictionary alloc] init]);
-
- [argumentDomain addEntriesFromDictionary:@{
- @"AppleLanguages": @[primaryLanguage]
- }];
- [[NSUserDefaults standardUserDefaults] setVolatileDomain:argumentDomain.get() forName:NSArgumentDomain];
-
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AppleLanguagePreferencesChangedNotification" object:nil userInfo:nil options:NSNotificationDeliverImmediately];
-
- [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
-}
-
-static NSString *languageForSystemLanguage(WebView* webView, NSString *systemLanguage)
-{
- overrideAppleLanguages(systemLanguage);
- return [webView stringByEvaluatingJavaScriptFromString:@"navigator.language"];
-}
-
-// These tests document current behavior. Some of the current results may not be right.
-NSArray *tests = @[
- @[@"ru", @"ru-RU"], // This does not match other browsers or CFNetwork's Accept-Language, which all use "ru".
- @[@"en", @"en-US"],
- @[@"en-GB", @"en-GB"],
- @[@"en-US", @"en-US"],
- @[@"ja", @"ja-JP"],
- @[@"hi", @"hi-IN"],
- @[@"zh-TW", @"zh-TW"], // This should not map to the generic zh-hant, see rdar://problem/21395180.
- @[@"zh-HK", @"zh-TW"],
- @[@"es", @"es-ES"],
- @[@"es-MX", @"es-XL"],
- @[@"es-ES", @"es-ES"],
- @[@"es-419", @"es-XL"],
- @[@"zh-Hans", @"zh-CN"],
- @[@"zh-Hant", @"zh-TW"],
- @[@"pt-BR", @"pt-BR"],
- @[@"pt-PT", @"pt-PT"],
- @[@"fr", @"fr-FR"],
- @[@"fr-CA", @"fr-CA"],
-];
-
-TEST(WebKitLegacy, NavigatorLanguage)
-{
- RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
- RetainPtr<NavigatorLanguageDelegate> frameLoadDelegate = adoptNS([NavigatorLanguageDelegate new]);
-
- webView.get().frameLoadDelegate = frameLoadDelegate.get();
- [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
-
- Util::run(&didFinishLoad);
- for (NSArray *test in tests)
- EXPECT_WK_STREQ([test objectAtIndex:1], languageForSystemLanguage(webView.get(), [test objectAtIndex:0]));
-}
-
-TEST(WKWebView, NavigatorLanguage)
-{
- RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-
- NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
- [webView loadRequest:request];
- __block bool isDone = false;
-
- __block void (^runTest)(NSUInteger) = ^(NSUInteger index) {
- NSArray *test = [tests objectAtIndex:index];
- overrideAppleLanguages([test objectAtIndex:0]);
- [webView evaluateJavaScript:@"navigator.language" completionHandler:^(id result, NSError *) {
- EXPECT_WK_STREQ([test objectAtIndex:1], result);
- if (index + 1 < [tests count])
- runTest(index + 1);
- else
- isDone = true;
- }];
- };
-
- runTest(0);
-
- TestWebKitAPI::Util::run(&isDone);
-}
-
-} // namespace TestWebKitAPI