<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[280811] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/280811">280811</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2021-08-09 17:07:45 -0700 (Mon, 09 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Create a Language log channel
https://bugs.webkit.org/show_bug.cgi?id=228764

Reviewed by Simon Fraser.

Source/WebKit:

* Platform/Logging.h:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::setAppleLanguagesPreference):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setOverrideLanguages):
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::userPreferredLanguagesChanged const):

Source/WTF:

There have been a variety of bug reports over the past months/years about the procedure
by which we determine navigator.language. It's actually somewhat convoluted, so this
patch adds a (debug) log channel for it so we can follow what it's doing easily.

To enable all the logging, run these commands:

% defaults write com.apple.WebKit.WebContent.Development WTFLogging Language
% defaults write com.apple.WebKit.WebContent.Development WebKit2Logging Language
% defaults write com.apple.WebKit.WebContent WTFLogging Language
% defaults write com.apple.WebKit.WebContent WebKit2Logging Language
% defaults write -g WTFLogging Language
% defaults write -g WebKit2Logging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WTFLogging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WebKit2Logging Language

* wtf/Language.cpp:
(WTF::defaultLanguage):
(WTF::overrideUserPreferredLanguages):
(WTF::userPreferredLanguages):
* wtf/Logging.cpp:
* wtf/Logging.h:
* wtf/cf/LanguageCF.cpp:
(WTF::platformUserPreferredLanguages):
* wtf/cocoa/LanguageCocoa.mm:
(WTF::minimizedLanguagesFromLanguages):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfLanguagecpp">trunk/Source/WTF/wtf/Language.cpp</a></li>
<li><a href="#trunkSourceWTFwtfLoggingcpp">trunk/Source/WTF/wtf/Logging.cpp</a></li>
<li><a href="#trunkSourceWTFwtfLoggingh">trunk/Source/WTF/wtf/Logging.h</a></li>
<li><a href="#trunkSourceWTFwtfcfLanguageCFcpp">trunk/Source/WTF/wtf/cf/LanguageCF.cpp</a></li>
<li><a href="#trunkSourceWTFwtfcocoaLanguageCocoamm">trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitPlatformLoggingh">trunk/Source/WebKit/Platform/Logging.h</a></li>
<li><a href="#trunkSourceWebKitSharedEntryPointUtilitiesCocoaXPCServiceXPCServiceMainmm">trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessLaunchermacProcessLauncherMacmm">trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolcpp">trunk/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcesscpp">trunk/Source/WebKit/WebProcess/WebProcess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/ChangeLog  2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><ins>+        Create a Language log channel
+        https://bugs.webkit.org/show_bug.cgi?id=228764
+
+        Reviewed by Simon Fraser.
+
+        There have been a variety of bug reports over the past months/years about the procedure
+        by which we determine navigator.language. It's actually somewhat convoluted, so this
+        patch adds a (debug) log channel for it so we can follow what it's doing easily.
+
+        To enable all the logging, run these commands:
+
+        % defaults write com.apple.WebKit.WebContent.Development WTFLogging Language
+        % defaults write com.apple.WebKit.WebContent.Development WebKit2Logging Language
+        % defaults write com.apple.WebKit.WebContent WTFLogging Language
+        % defaults write com.apple.WebKit.WebContent WebKit2Logging Language
+        % defaults write -g WTFLogging Language
+        % defaults write -g WebKit2Logging Language
+        % defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WTFLogging Language
+        % defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WebKit2Logging Language
+
+        * wtf/Language.cpp:
+        (WTF::defaultLanguage):
+        (WTF::overrideUserPreferredLanguages):
+        (WTF::userPreferredLanguages):
+        * wtf/Logging.cpp:
+        * wtf/Logging.h:
+        * wtf/cf/LanguageCF.cpp:
+        (WTF::platformUserPreferredLanguages):
+        * wtf/cocoa/LanguageCocoa.mm:
+        (WTF::minimizedLanguagesFromLanguages):
+
+2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
</ins><span class="cx">         Support WTF logging channels
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=228768
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfLanguagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Language.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Language.cpp        2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/wtf/Language.cpp   2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -28,7 +28,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/Lock.h>
</span><ins>+#include <wtf/Logging.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><ins>+#include <wtf/text/TextStream.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx"> 
</span><span class="cx"> #if USE(CF) && !PLATFORM(WIN)
</span><span class="lines">@@ -95,9 +97,12 @@
</span><span class="cx"> String defaultLanguage(ShouldMinimizeLanguages shouldMinimizeLanguages)
</span><span class="cx"> {
</span><span class="cx">     auto languages = userPreferredLanguages(shouldMinimizeLanguages);
</span><del>-    if (languages.size())
</del><ins>+    if (languages.size()) {
+        LOG_WITH_STREAM(Language, stream << "defaultLanguage() is returning " << languages[0]);
</ins><span class="cx">         return languages[0];
</span><ins>+    }
</ins><span class="cx"> 
</span><ins>+    LOG(Language, "defaultLanguage() is returning the empty string.");
</ins><span class="cx">     return emptyString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -109,6 +114,7 @@
</span><span class="cx"> 
</span><span class="cx"> void overrideUserPreferredLanguages(const Vector<String>& override)
</span><span class="cx"> {
</span><ins>+    LOG_WITH_STREAM(Language, stream << "Languages are being overridden to: " << override);
</ins><span class="cx">     {
</span><span class="cx">         Locker locker { preferredLanguagesOverrideLock };
</span><span class="cx">         preferredLanguagesOverride() = override;
</span><span class="lines">@@ -130,14 +136,19 @@
</span><span class="cx">     {
</span><span class="cx">         Locker locker { preferredLanguagesOverrideLock };
</span><span class="cx">         Vector<String>& override = preferredLanguagesOverride();
</span><del>-        if (!override.isEmpty())
</del><ins>+        if (!override.isEmpty()) {
+            LOG_WITH_STREAM(Language, stream << "Languages are overridden: " << override);
</ins><span class="cx">             return isolatedCopy(override);
</span><ins>+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Locker locker { cachedPlatformPreferredLanguagesLock };
</span><span class="cx">     auto& languages = shouldMinimizeLanguages == ShouldMinimizeLanguages::Yes ? cachedMinimizedPlatformPreferredLanguages() : cachedFullPlatformPreferredLanguages();
</span><del>-    if (languages.isEmpty())
</del><ins>+    if (languages.isEmpty()) {
+        LOG(Language, "userPreferredLanguages() cache miss");
</ins><span class="cx">         languages = platformUserPreferredLanguages(shouldMinimizeLanguages);
</span><ins>+    } else
+        LOG(Language, "userPreferredLanguages() cache hit");
</ins><span class="cx">     return isolatedCopy(languages);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfLoggingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Logging.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Logging.cpp 2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/wtf/Logging.cpp    2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !LOG_DISABLED || !RELEASE_LOG_DISABLED
</span><span class="cx"> 
</span><ins>+DEFINE_LOG_CHANNEL(Language, LOG_CHANNEL_WEBKIT_SUBSYSTEM);
</ins><span class="cx"> DEFINE_LOG_CHANNEL_WITH_DETAILS(RefCountedLeaks, logChannelStateOn,  logLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM);
</span><span class="cx"> DEFINE_LOG_CHANNEL_WITH_DETAILS(Process,         logChannelStateOn,  logLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM);
</span><span class="cx"> DEFINE_LOG_CHANNEL_WITH_DETAILS(Threading,       logChannelStateOn,  logLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM);
</span></span></pre></div>
<a id="trunkSourceWTFwtfLoggingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Logging.h (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Logging.h   2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/wtf/Logging.h      2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #define WTF_LOG_CHANNELS(M) \
</span><ins>+    M(Language) \
</ins><span class="cx">     M(RefCountedLeaks) \
</span><span class="cx">     M(Process) \
</span><span class="cx">     M(Threading) \
</span></span></pre></div>
<a id="trunkSourceWTFwtfcfLanguageCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/cf/LanguageCF.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/cf/LanguageCF.cpp   2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/wtf/cf/LanguageCF.cpp      2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -30,8 +30,10 @@
</span><span class="cx"> #include <mutex>
</span><span class="cx"> #include <unicode/uloc.h>
</span><span class="cx"> #include <wtf/Assertions.h>
</span><ins>+#include <wtf/Logging.h>
</ins><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/spi/cf/CFBundleSPI.h>
</span><ins>+#include <wtf/text/TextStream.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -88,9 +90,13 @@
</span><span class="cx"> {
</span><span class="cx">     auto platformLanguages = adoptCF(CFLocaleCopyPreferredLanguages());
</span><span class="cx"> 
</span><ins>+    LOG_WITH_STREAM(Language, stream << "CFLocaleCopyPreferredLanguages() returned: " << reinterpret_cast<id>(const_cast<CFMutableArrayRef>(platformLanguages.get())));
+
</ins><span class="cx">     if (shouldMinimizeLanguages == ShouldMinimizeLanguages::Yes)
</span><span class="cx">         platformLanguages = minimizedLanguagesFromLanguages(platformLanguages.get());
</span><span class="cx"> 
</span><ins>+    LOG_WITH_STREAM(Language, stream << "Minimized languages: " << reinterpret_cast<id>(const_cast<CFMutableArrayRef>(platformLanguages.get())));
+
</ins><span class="cx">     CFIndex platformLanguagesCount = CFArrayGetCount(platformLanguages.get());
</span><span class="cx">     if (!platformLanguagesCount)
</span><span class="cx">         return { "en"_s };
</span><span class="lines">@@ -100,6 +106,9 @@
</span><span class="cx">         auto platformLanguage = static_cast<CFStringRef>(CFArrayGetValueAtIndex(platformLanguages.get(), i));
</span><span class="cx">         languages.append(httpStyleLanguageCode(platformLanguage, shouldMinimizeLanguages));
</span><span class="cx">     }
</span><ins>+
+    LOG_WITH_STREAM(Language, stream << "After passing through httpStyleLanguageCode: " << languages);
+
</ins><span class="cx">     return languages;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfcocoaLanguageCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm      2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm 2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import <wtf/Language.h>
</span><span class="cx"> 
</span><ins>+#import <wtf/Logging.h>
</ins><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
</span><span class="lines">@@ -70,8 +71,10 @@
</span><span class="cx"> 
</span><span class="cx"> RetainPtr<CFArrayRef> minimizedLanguagesFromLanguages(CFArrayRef languages)
</span><span class="cx"> {
</span><del>-    if (!canMinimizeLanguages())
</del><ins>+    if (!canMinimizeLanguages()) {
+        LOG(Language, "Could not minimize languages.");
</ins><span class="cx">         return languages;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx"> ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN
</span><span class="cx">     return (__bridge CFArrayRef)[NSLocale minimizedLanguagesFromLanguages:(__bridge NSArray<NSString *> *)languages];
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/ChangeLog       2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><ins>+        Create a Language log channel
+        https://bugs.webkit.org/show_bug.cgi?id=228764
+
+        Reviewed by Simon Fraser.
+
+        * Platform/Logging.h:
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+        (WebKit::setAppleLanguagesPreference):
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::setOverrideLanguages):
+        (WebKit::WebProcessPool::initializeNewWebProcess):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::getLaunchOptions):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::userPreferredLanguagesChanged const):
+
+2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
</ins><span class="cx">         Support WTF logging channels
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=228768
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformLoggingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Platform/Logging.h (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Platform/Logging.h   2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/Platform/Logging.h      2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     M(IndexedDB) \
</span><span class="cx">     M(Inspector) \
</span><span class="cx">     M(KeyHandling) \
</span><ins>+    M(Language) \
</ins><span class="cx">     M(Layers) \
</span><span class="cx">     M(Layout) \
</span><span class="cx">     M(Loading) \
</span></span></pre></div>
<a id="trunkSourceWebKitSharedEntryPointUtilitiesCocoaXPCServiceXPCServiceMainmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm        2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm   2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -54,10 +54,14 @@
</span><span class="cx">                 [newLanguages addObject:[NSString stringWithCString:xpc_string_get_string_ptr(value) encoding:NSUTF8StringEncoding]];
</span><span class="cx">                 return true;
</span><span class="cx">             });
</span><ins>+
+            LOG_WITH_STREAM(Language, stream << "Bootstrap message contains OverrideLanguages: " << newLanguages.get());
+
</ins><span class="cx">             [newArguments setValue:newLanguages.get() forKey:@"AppleLanguages"];
</span><span class="cx">             [[NSUserDefaults standardUserDefaults] setVolatileDomain:newArguments.get() forName:NSArgumentDomain];
</span><span class="cx">         }
</span><del>-    }
</del><ins>+    } else
+        LOG(Language, "Bootstrap message does not contain OverrideLanguages");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void XPCServiceEventHandler(xpc_connection_t peer)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessLaunchermacProcessLauncherMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm    2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import "ProcessLauncher.h"
</span><span class="cx"> 
</span><ins>+#import "Logging.h"
</ins><span class="cx"> #import "ReasonSPI.h"
</span><span class="cx"> #import "WebPreferencesDefaultValues.h"
</span><span class="cx"> #import <WebCore/RuntimeApplicationChecks.h>
</span><span class="lines">@@ -151,6 +152,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto languagesIterator = m_launchOptions.extraInitializationData.find("OverrideLanguages");
</span><span class="cx">     if (languagesIterator != m_launchOptions.extraInitializationData.end()) {
</span><ins>+        LOG_WITH_STREAM(Language, stream << "Process Launcher is copying OverrideLanguages into initialization message: " << languagesIterator->value);
</ins><span class="cx">         auto languages = adoptOSObject(xpc_array_create(nullptr, 0));
</span><span class="cx">         for (auto& language : languagesIterator->value.split(','))
</span><span class="cx">             xpc_array_set_string(languages.get(), XPC_ARRAY_APPEND, language.utf8().data());
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp    2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -368,6 +368,7 @@
</span><span class="cx"> {
</span><span class="cx">     m_configuration->setOverrideLanguages(WTFMove(languages));
</span><span class="cx"> 
</span><ins>+    LOG_WITH_STREAM(Language, stream << "WebProcessPool is setting OverrideLanguages: " << languages);
</ins><span class="cx">     sendToAllProcesses(Messages::WebProcess::UserPreferredLanguagesChanged(m_configuration->overrideLanguages()));
</span><span class="cx"> #if USE(SOUP)
</span><span class="cx">     for (auto networkProcess : NetworkProcessProxy::allNetworkProcesses())
</span><span class="lines">@@ -754,6 +755,7 @@
</span><span class="cx"> 
</span><span class="cx">     parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel();
</span><span class="cx">     parameters.overrideLanguages = configuration().overrideLanguages();
</span><ins>+    LOG_WITH_STREAM(Language, stream << "WebProcessPool is initializing a new web process with overrideLanguages: " << parameters.overrideLanguages);
</ins><span class="cx"> 
</span><span class="cx">     parameters.urlSchemesRegisteredAsEmptyDocument = copyToVector(m_schemesToRegisterAsEmptyDocument);
</span><span class="cx">     parameters.urlSchemesRegisteredAsSecure = copyToVector(LegacyGlobalSettings::singleton().schemesToRegisterAsSecure());
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -362,9 +362,12 @@
</span><span class="cx">     if (WebKit::isInspectorProcessPool(processPool()))
</span><span class="cx">         launchOptions.extraInitializationData.add("inspector-process"_s, "1"_s);
</span><span class="cx"> 
</span><ins>+    LOG(Language, "WebProcessProxy is getting launch options.");
</ins><span class="cx">     auto overrideLanguages = m_processPool->configuration().overrideLanguages();
</span><del>-    if (overrideLanguages.isEmpty())
</del><ins>+    if (overrideLanguages.isEmpty()) {
+        LOG(Language, "overrideLanguages() reports empty. Calling platformOverrideLanguages()");
</ins><span class="cx">         overrideLanguages = platformOverrideLanguages();
</span><ins>+    }
</ins><span class="cx">     if (!overrideLanguages.isEmpty()) {
</span><span class="cx">         StringBuilder languageString;
</span><span class="cx">         for (size_t i = 0; i < overrideLanguages.size(); ++i) {
</span><span class="lines">@@ -372,8 +375,10 @@
</span><span class="cx">                 languageString.append(',');
</span><span class="cx">             languageString.append(overrideLanguages[i]);
</span><span class="cx">         }
</span><ins>+        LOG_WITH_STREAM(Language, stream << "Setting WebProcess's launch OverrideLanguages to " << languageString);
</ins><span class="cx">         launchOptions.extraInitializationData.add("OverrideLanguages"_s, languageString.toString());
</span><del>-    }
</del><ins>+    } else
+        LOG(Language, "overrideLanguages is still empty. Not setting WebProcess's launch OverrideLanguages.");
</ins><span class="cx"> 
</span><span class="cx">     launchOptions.nonValidInjectedCodeAllowed = shouldAllowNonValidInjectedCode();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (280810 => 280811)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.cpp    2021-08-09 23:59:44 UTC (rev 280810)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp       2021-08-10 00:07:45 UTC (rev 280811)
</span><span class="lines">@@ -456,8 +456,11 @@
</span><span class="cx"> 
</span><span class="cx">     setCacheModel(parameters.cacheModel);
</span><span class="cx"> 
</span><del>-    if (!parameters.overrideLanguages.isEmpty())
</del><ins>+    if (!parameters.overrideLanguages.isEmpty()) {
+        LOG_WITH_STREAM(Language, stream << "Web Process initialization is setting overrideLanguages: " << parameters.overrideLanguages);
</ins><span class="cx">         overrideUserPreferredLanguages(parameters.overrideLanguages);
</span><ins>+    } else
+        LOG(Language, "Web process initialization is not setting overrideLanguages");
</ins><span class="cx"> 
</span><span class="cx">     m_textCheckerState = parameters.textCheckerState;
</span><span class="cx"> 
</span><span class="lines">@@ -727,6 +730,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::userPreferredLanguagesChanged(const Vector<String>& languages) const
</span><span class="cx"> {
</span><ins>+    LOG_WITH_STREAM(Language, stream << "The web process's userPreferredLanguagesChanged: " << languages);
</ins><span class="cx">     overrideUserPreferredLanguages(languages);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>