RESOLVED FIXED Bug 200043
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
Summary REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's...
Myles C. Maxfield
Reported 2019-07-23 13:00:59 PDT
In the Hong Kong locale, navigator.language reports it's in the Taiwan locale
Attachments
Patch (47.67 KB, patch)
2019-07-23 13:07 PDT, Myles C. Maxfield
no flags
Archive of layout-test-results from ews103 for mac-highsierra (3.32 MB, application/zip)
2019-07-23 14:16 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (2.71 MB, application/zip)
2019-07-23 14:35 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews115 for mac-highsierra (3.11 MB, application/zip)
2019-07-23 15:18 PDT, EWS Watchlist
no flags
Patch (45.31 KB, patch)
2019-10-18 15:06 PDT, Myles C. Maxfield
rniwa: review+
Patch for reviewing (45.92 KB, patch)
2019-10-18 17:13 PDT, Myles C. Maxfield
no flags
Patch (55.74 KB, patch)
2019-12-18 15:31 PST, Myles C. Maxfield
no flags
Patch (57.30 KB, patch)
2019-12-18 16:08 PST, Myles C. Maxfield
no flags
Patch (57.78 KB, patch)
2020-01-08 18:01 PST, Myles C. Maxfield
dino: review+
Myles C. Maxfield
Comment 1 2019-07-23 13:07:38 PDT
Alexey Proskuryakov
Comment 2 2019-07-23 13:16:16 PDT
Comment on attachment 374701 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374701&action=review > Source/WTF/ChangeLog:14 > + Nowadays, CFLocaleCopyPreferredLanguages() reports real BCP47 language codes, so we don't have to do any Does it actually perform the normalization, or is it just that System Preferences writes BCP47 language codes in new OS versions? People who've been using macOS for a while may still have non-BCP47 preferred languages. One way to test would be to override AppleLanguages. > Source/WTF/wtf/cf/LanguageCF.cpp:-59 > - // 3. This should probably match what is sent by the network layer as Accept-Language, but currently, that's implemented separately. This one remains true.
Alexey Proskuryakov
Comment 3 2019-07-23 13:28:33 PDT
As this adds differentiation especially for languages that are less frequently used, some people may now be uniquely identified with low-tech methods like looking at navigator.userAgent and navigator.language. I'm all for improving language support, especially when removing such ugly hacks, however we may want to consult with privacy experts.
EWS Watchlist
Comment 4 2019-07-23 14:16:27 PDT
Comment on attachment 374701 [details] Patch Attachment 374701 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/12796133 New failing tests: js/dom/navigator-language.html
EWS Watchlist
Comment 5 2019-07-23 14:16:28 PDT
Created attachment 374708 [details] Archive of layout-test-results from ews103 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 6 2019-07-23 14:35:12 PDT
Comment on attachment 374701 [details] Patch Attachment 374701 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/12796226 New failing tests: js/dom/navigator-language.html
EWS Watchlist
Comment 7 2019-07-23 14:35:14 PDT
Created attachment 374711 [details] Archive of layout-test-results from ews105 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 8 2019-07-23 15:18:44 PDT
Comment on attachment 374701 [details] Patch Attachment 374701 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12796336 New failing tests: js/dom/navigator-language.html
EWS Watchlist
Comment 9 2019-07-23 15:18:46 PDT
Created attachment 374713 [details] Archive of layout-test-results from ews115 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-highsierra Platform: Mac OS X 10.13.6
Myles C. Maxfield
Comment 10 2019-10-18 15:06:25 PDT
Myles C. Maxfield
Comment 11 2019-10-18 15:07:07 PDT
Ryosuke Niwa
Comment 12 2019-10-18 15:40:30 PDT
Comment on attachment 381336 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=381336&action=review > Source/WTF/ChangeLog:17 > + Reviewed by NOBODY (OOPS!). Nit: This line should appear before the long description.
Myles C. Maxfield
Comment 13 2019-10-18 17:12:12 PDT
Oh, I forgot to update a test result.
Myles C. Maxfield
Comment 14 2019-10-18 17:13:58 PDT
Created attachment 381351 [details] Patch for reviewing
Myles C. Maxfield
Comment 15 2019-10-23 12:06:31 PDT
Comment on attachment 381336 [details] Patch We're going to solve this a different way, which protects privacy better.
Myles C. Maxfield
Comment 16 2019-12-18 15:31:38 PST
Myles C. Maxfield
Comment 17 2019-12-18 16:08:57 PST
Ryosuke Niwa
Comment 18 2019-12-18 19:42:39 PST
The test failure looks real: --- /Volumes/Data/worker/macOS-High-Sierra-Release-WK1-Tests-EWS/build/layout-test-results/js/dom/navigator-language-expected.txt +++ /Volumes/Data/worker/macOS-High-Sierra-Release-WK1-Tests-EWS/build/layout-test-results/js/dom/navigator-language-actual.txt @@ -2,7 +2,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS language is 'en' +FAIL language should be en-US. Was en-us. PASS successfullyParsed is true TEST COMPLETE
Myles C. Maxfield
Comment 19 2020-01-08 18:01:44 PST
Alexey Proskuryakov
Comment 20 2020-01-08 18:12:08 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review Just a comment about something that caught my eye, didn’t attempt to review the rest of the patch. > LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB.html:4 > +<script src="../../../../../resources/js-test-pre.js"></script> Can all of the tests use js-test.js instead of pre/post? That’s generally preferred due to simplicity.
Dean Jackson
Comment 21 2020-01-09 10:48:51 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review >> LayoutTests/fast/text/international/system-language/navigator-language/navigator-language-en-GB.html:4 >> +<script src="../../../../../resources/js-test-pre.js"></script> > > Can all of the tests use js-test.js instead of pre/post? That’s generally preferred due to simplicity. Or just write your own small .js file in this directory to expose shouldBeEqualToString and do the dump as text stuff.
Myles C. Maxfield
Comment 22 2020-01-10 19:05:37 PST
Myles C. Maxfield
Comment 23 2020-01-10 20:58:19 PST
WebKit Commit Bot
Comment 24 2020-01-11 17:16:58 PST
Re-opened since this is blocked by bug 206134
Myles C. Maxfield
Comment 25 2020-01-11 17:40:27 PST
This broke internal builds. Investigating now.
Simon Fraser (smfr)
Comment 26 2020-01-11 20:46:37 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review > Source/WTF/wtf/cocoa/LanguageCocoa.mm:36 > + static NeverDestroyed<bool> result = [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)]; static bool should be enough.
Myles C. Maxfield
Comment 27 2020-01-11 22:46:26 PST
https://bugs.webkit.org/show_bug.cgi?id=206135 should fix the internal builds.
Myles C. Maxfield
Comment 28 2020-01-11 23:16:52 PST
Myles C. Maxfield
Comment 29 2020-01-11 23:22:55 PST
Myles C. Maxfield
Comment 30 2020-01-11 23:44:27 PST
Myles C. Maxfield
Comment 31 2020-01-11 23:44:44 PST
Myles C. Maxfield
Comment 32 2020-01-12 13:30:32 PST
Myles C. Maxfield
Comment 33 2020-01-12 13:30:50 PST
Brent Fulgham
Comment 34 2020-01-23 14:48:17 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review > Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h:30 > +#import <InternationalSupport/NSLocale+InternationalSupportExtensions.h> Does this exist on all supported macOS build targets?
Chris Dumez
Comment 35 2020-01-30 10:55:13 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review > Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h:35 > ++ (nonnull NSArray<NSString *> *)minimizedLanguagesFromLanguages:(nonnull NSArray<NSString *> *)languages; Note that on my macOS SDK, even though I do have the <InternationalSupport/NSLocale+InternationalSupportExtensions.h> header, it does not declare this method (minimizedLanguagesFromLanguages). My iOS SDK does have it though. Does this fix really work on macOS? Is it supposed to be iOS-only.
Chris Dumez
Comment 36 2020-01-30 11:00:56 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review >> Source/WTF/wtf/cocoa/LanguageCocoa.mm:36 >> + static NeverDestroyed<bool> result = [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)]; > > static bool should be enough. I guess this would just return false on macOS since it would not be able to find this method.
Myles C. Maxfield
Comment 37 2020-02-06 14:35:51 PST
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review >> Source/WTF/wtf/spi/cocoa/NSLocaleSPI.h:35 >> ++ (nonnull NSArray<NSString *> *)minimizedLanguagesFromLanguages:(nonnull NSArray<NSString *> *)languages; > > Note that on my macOS SDK, even though I do have the <InternationalSupport/NSLocale+InternationalSupportExtensions.h> header, it does not declare this method (minimizedLanguagesFromLanguages). My iOS SDK does have it though. Does this fix really work on macOS? Is it supposed to be iOS-only. Your macOS SDK is probably too old. + (nonnull NSArray <NSString *> *)minimizedLanguagesFromLanguages:(nonnull NSArray <NSString *> *)languages API_AVAILABLE(macos(10.15.4), ios(13.4), watchos(6.4), tvos(13.4));
Chris Dumez
Comment 38 2021-05-06 08:04:08 PDT
It seems this may have made navigator.language / navigator.languages return all lowercase strings again? (see Bug 163096). Per spec, it should be "en-US" not "en-us".
Myles C. Maxfield
Comment 39 2021-05-06 08:38:10 PDT
(In reply to Chris Dumez from comment #38) > It seems this may have made navigator.language / navigator.languages return > all lowercase strings again? (see Bug 163096). Per spec, it should be > "en-US" not "en-us". I don’t know about “again,” but yes, this lowercases the strings: CFStringLowercase(mutableLanguageCode.get(), nullptr); I did it for consistency with the behavior before this patch. Before this patch, the strings were lower-cased, too.
Chris Dumez
Comment 40 2021-05-06 08:39:28 PDT
Comment on attachment 387174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387174&action=review > LayoutTests/js/dom/navigator-language.html:-21 > - shouldBe("language", "'en-US'"); Really? > LayoutTests/js/dom/navigator-language.html:21 > + shouldBe("language", "'en-us'"); Then why this?
Chris Dumez
Comment 41 2021-05-06 08:40:50 PDT
(In reply to Myles C. Maxfield from comment #39) > (In reply to Chris Dumez from comment #38) > > It seems this may have made navigator.language / navigator.languages return > > all lowercase strings again? (see Bug 163096). Per spec, it should be > > "en-US" not "en-us". > > I don’t know about “again,” but yes, this lowercases the strings: Again because I fixed it once here: Bug 163096.
Chris Dumez
Comment 42 2021-05-06 09:35:46 PDT
(In reply to Chris Dumez from comment #41) > (In reply to Myles C. Maxfield from comment #39) > > (In reply to Chris Dumez from comment #38) > > > It seems this may have made navigator.language / navigator.languages return > > > all lowercase strings again? (see Bug 163096). Per spec, it should be > > > "en-US" not "en-us". > > > > I don’t know about “again,” but yes, this lowercases the strings: > > Again because I fixed it once here: Bug 163096. I have fixed Bug 225461.
Chris Dumez
Comment 43 2021-05-06 09:39:12 PDT
(In reply to Chris Dumez from comment #42) > (In reply to Chris Dumez from comment #41) > > (In reply to Myles C. Maxfield from comment #39) > > > (In reply to Chris Dumez from comment #38) > > > > It seems this may have made navigator.language / navigator.languages return > > > > all lowercase strings again? (see Bug 163096). Per spec, it should be > > > > "en-US" not "en-us". > > > > > > I don’t know about “again,” but yes, this lowercases the strings: > > > > Again because I fixed it once here: Bug 163096. > > I have fixed Bug 225461. I have *filed* Bug 225461.
Note You need to log in before you can comment on or make changes to this bug.