Bug 213488

Summary: [Cocoa] Avoid copying the default AppleLanguage preference to the WebContent process
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: NEW ---    
Severity: Normal CC: bfulgham, cdumez, ggaren
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=213214
Attachments:
Description Flags
Patch cdumez: review-

Description Per Arne Vollan 2020-06-22 13:59:32 PDT
There is no need to copy the default AppleLanguage preference from the UI process to the WebContent process. The value of this key is available in the WebContent process using the preferences API.
Comment 1 Per Arne Vollan 2020-06-22 14:06:26 PDT
Created attachment 402512 [details]
Patch
Comment 2 Geoffrey Garen 2020-06-22 15:52:10 PDT
Comment on attachment 402512 [details]
Patch

r=me
Comment 3 Per Arne Vollan 2020-06-22 15:56:24 PDT
(In reply to Geoffrey Garen from comment #2)
> Comment on attachment 402512 [details]
> Patch
> 
> r=me

Thanks for reviewing!
Comment 4 Chris Dumez 2020-06-22 15:56:43 PDT
Comment on attachment 402512 [details]
Patch

It looks like you are reverting my fix from a few days ago.
Comment 5 Chris Dumez 2020-06-22 16:02:39 PDT
Comment on attachment 402512 [details]
Patch

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

> Source/WebKit/UIProcess/WebProcessProxy.cpp:-321
> -        overrideLanguages = platformOverrideLanguages();

With this change, if a user did:
dvdo defaults write com.apple.Safari AppleLanguages '("en-US", "fr-FR")'

navigator.languages would not be impacted by the Safari user default anymore. We need to read the UIProcess UserDefault for AppleLanguages here, send it over XPC and then set AppleLanguages to this value in the WebProcess.
Comment 6 Per Arne Vollan 2020-06-22 16:03:50 PDT
(In reply to Chris Dumez from comment #5)
> Comment on attachment 402512 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=402512&action=review
> 
> > Source/WebKit/UIProcess/WebProcessProxy.cpp:-321
> > -        overrideLanguages = platformOverrideLanguages();
> 
> With this change, if a user did:
> dvdo defaults write com.apple.Safari AppleLanguages '("en-US", "fr-FR")'
> 
> navigator.languages would not be impacted by the Safari user default
> anymore. We need to read the UIProcess UserDefault for AppleLanguages here,
> send it over XPC and then set AppleLanguages to this value in the WebProcess.

Right, I see how this change would break that.

Thanks for reviewing!