Bug 222619 - [macOS][WK2] Changing the system language does not update navigator.language
Summary: [macOS][WK2] Changing the system language does not update navigator.language
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-02 14:54 PST by Chris Dumez
Modified: 2021-03-09 20:34 PST (History)
8 users (show)

See Also:


Attachments
Patch (16.78 KB, patch)
2021-03-02 15:21 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (16.80 KB, patch)
2021-03-02 16:31 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (17.85 KB, patch)
2021-03-02 17:06 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (17.85 KB, patch)
2021-03-03 07:52 PST, Chris Dumez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (17.86 KB, patch)
2021-03-03 07:55 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.29 KB, patch)
2021-03-03 09:44 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.71 KB, patch)
2021-03-03 10:49 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.24 KB, patch)
2021-03-04 09:28 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.42 KB, patch)
2021-03-04 10:01 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-03-02 14:54:50 PST
Changing the system language does not update navigator.language on macOS WK2.
Comment 1 Chris Dumez 2021-03-02 15:21:59 PST
Created attachment 422004 [details]
Patch
Comment 2 Chris Dumez 2021-03-02 16:31:39 PST
Created attachment 422021 [details]
Patch
Comment 3 Chris Dumez 2021-03-02 17:06:48 PST
Created attachment 422027 [details]
Patch
Comment 4 Chris Dumez 2021-03-02 18:27:41 PST
Looks like my new api test is failing in the bot. The bot has CFPREFS_DIRECT_MODE disabled, which is a configuration I cannot test easily. I will try and figure it out. @Per: please let me know if the issue is obvious to you since you are more familiar with this code.
Comment 5 Chris Dumez 2021-03-03 07:52:53 PST
Created attachment 422082 [details]
Patch
Comment 6 Chris Dumez 2021-03-03 07:55:06 PST
Created attachment 422083 [details]
Patch
Comment 7 Chris Dumez 2021-03-03 09:44:20 PST
Created attachment 422104 [details]
Patch
Comment 8 Chris Dumez 2021-03-03 10:49:19 PST
Created attachment 422116 [details]
Patch
Comment 9 Per Arne Vollan 2021-03-03 15:34:15 PST
Comment on attachment 422116 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422116&action=review

R=me.

> Tools/TestWebKitAPI/Tests/WebKit/OverrideAppleLanguagesPreference.mm:121
> +    system([NSString stringWithFormat:@"defaults write NSGlobalDomain AppleLanguages '(\"en-GB\")'"].UTF8String);

Does TestWebKitAPI need to be brought into the foreground for the preference change to be picked up, since the preference observer in the UI process is started when the UI process becomes foreground?
Comment 10 Chris Dumez 2021-03-03 15:38:38 PST
Comment on attachment 422116 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422116&action=review

> Tools/TestWebKitAPI/Tests/WebKit/OverrideAppleLanguagesPreference.mm:98
> +    [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationDidBecomeActiveNotification object:NSApp userInfo:nil];

See here.

>> Tools/TestWebKitAPI/Tests/WebKit/OverrideAppleLanguagesPreference.mm:121
>> +    system([NSString stringWithFormat:@"defaults write NSGlobalDomain AppleLanguages '(\"en-GB\")'"].UTF8String);
> 
> Does TestWebKitAPI need to be brought into the foreground for the preference change to be picked up, since the preference observer in the UI process is started when the UI process becomes foreground?

Yes, it does. See my earlier comment.
Comment 11 EWS 2021-03-03 15:46:26 PST
Committed r273851: <https://commits.webkit.org/r273851>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422116 [details].
Comment 12 Radar WebKit Bug Importer 2021-03-03 15:47:35 PST
<rdar://problem/75007471>
Comment 13 Ryan Haddad 2021-03-03 17:45:43 PST
19 fast/text/international/system-language tests are failing after this change on Big Sur bots. See https://bugs.webkit.org/show_bug.cgi?id=222702
Comment 14 Chris Dumez 2021-03-03 17:51:00 PST
Reverted r273851 for reason:

Caused some tests failures on macOS Big Sur

Committed r273867 (234828@main): <https://commits.webkit.org/234828@main>
Comment 15 Chris Dumez 2021-03-04 09:28:30 PST
Created attachment 422239 [details]
Patch
Comment 16 EWS 2021-03-04 09:55:55 PST
ChangeLog entry in Source/WebKitLegacy/mac/ChangeLog contains OOPS!.
Comment 17 Chris Dumez 2021-03-04 10:01:48 PST
Created attachment 422250 [details]
Patch
Comment 18 EWS 2021-03-04 11:02:33 PST
Committed r273904: <https://commits.webkit.org/r273904>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422250 [details].