Title: [154396] trunk/Source/WebKit2
- Revision
- 154396
- Author
- [email protected]
- Date
- 2013-08-21 10:25:28 -0700 (Wed, 21 Aug 2013)
Log Message
REGRESSION (r145458?): WebProcess doesn't respect UI process localization
https://bugs.webkit.org/show_bug.cgi?id=120096
Reviewed by Darin Adler.
We used to get into a situation where CFBundle thought that we had no good localization,
and used one passed as default. This is never the case with mixed localizations,
so default is just ignored now.
I think that the previous behavior was a bit of a hack. As WebProcess is not localized,
it's more honest to say that we want mixed localizations, and force the language
to match UI process localization.
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
(WebKit::ChildProcessMain): Don't set default localization, it's not taken into
consideration unless all other attempts to compute bundle localization fail.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::createProcess): Pass
UI process localization as -AppleLanguages argument, so that Core Foundation uses
that instead of actual user languages. We want to match UI process localization.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (154395 => 154396)
--- trunk/Source/WebKit2/ChangeLog 2013-08-21 17:19:22 UTC (rev 154395)
+++ trunk/Source/WebKit2/ChangeLog 2013-08-21 17:25:28 UTC (rev 154396)
@@ -1,3 +1,26 @@
+2013-08-21 Alexey Proskuryakov <[email protected]>
+
+ REGRESSION (r145458?): WebProcess doesn't respect UI process localization
+ https://bugs.webkit.org/show_bug.cgi?id=120096
+
+ Reviewed by Darin Adler.
+
+ We used to get into a situation where CFBundle thought that we had no good localization,
+ and used one passed as default. This is never the case with mixed localizations,
+ so default is just ignored now.
+
+ I think that the previous behavior was a bit of a hack. As WebProcess is not localized,
+ it's more honest to say that we want mixed localizations, and force the language
+ to match UI process localization.
+
+ * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
+ (WebKit::ChildProcessMain): Don't set default localization, it's not taken into
+ consideration unless all other attempts to compute bundle localization fail.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::createProcess): Pass
+ UI process localization as -AppleLanguages argument, so that Core Foundation uses
+ that instead of actual user languages. We want to match UI process localization.
+
2013-08-20 Gavin Barraclough <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=120093
Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h (154395 => 154396)
--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h 2013-08-21 17:19:22 UTC (rev 154395)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h 2013-08-21 17:25:28 UTC (rev 154396)
@@ -86,12 +86,6 @@
if (!delegate.getExtraInitializationData(parameters.extraInitializationData))
return EXIT_FAILURE;
- // FIXME: This should be moved to ChildProcessMac if it is still necessary.
- String localization = commandLine["localization"];
- RetainPtr<CFStringRef> cfLocalization = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));
- if (cfLocalization)
- WKSetDefaultLocalization(cfLocalization.get());
-
ChildProcessType::shared().initialize(parameters);
}
Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (154395 => 154396)
--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2013-08-21 17:19:22 UTC (rev 154395)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2013-08-21 17:25:28 UTC (rev 154396)
@@ -383,9 +383,6 @@
// Insert a send right so we can send to it.
mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND);
- RetainPtr<CFStringRef> cfLocalization = adoptCF(WKCopyCFLocalizationPreferredName(NULL));
- CString localization = String(cfLocalization.get()).utf8();
-
NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"];
NSString *processPath = nil;
@@ -419,6 +416,12 @@
// Make a unique, per pid, per process launcher web process service name.
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), that).utf8();
+ // Inherit UI process localization. It can be different from child process default localization:
+ // 1. When the application and system frameworks simply have different localized resources available, we should match the application.
+ // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
+ // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
+ CString appleLanguagesArgument = String("('" + String(adoptCF(WKCopyCFLocalizationPreferredName(0)).get()) + "')").utf8();
+
Vector<const char*> args;
args.append([processAppExecutablePath fileSystemRepresentation]);
args.append([frameworkExecutablePath fileSystemRepresentation]);
@@ -426,12 +429,12 @@
args.append(ProcessLauncher::processTypeAsString(launchOptions.processType));
args.append("-servicename");
args.append(serviceName.data());
- args.append("-localization");
- args.append(localization.data());
args.append("-client-identifier");
args.append(clientIdentifier.data());
args.append("-ui-process-name");
args.append([[[NSProcessInfo processInfo] processName] UTF8String]);
+ args.append("-AppleLanguages"); // This argument will be handled by Core Foundation.
+ args.append(appleLanguagesArgument.data());
HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin();
HashMap<String, String>::const_iterator end = launchOptions.extraInitializationData.end();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes