Commit 5b8c677c authored by ap@apple.com's avatar ap@apple.com
Browse files

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9be185b7
2013-08-21 Alexey Proskuryakov <ap@apple.com>
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 <barraclough@apple.com>
 
https://bugs.webkit.org/show_bug.cgi?id=120093
......
......@@ -86,12 +86,6 @@ int ChildProcessMain(int argc, char** argv)
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);
}
......
......@@ -383,9 +383,6 @@ static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, b
// 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 @@ static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, b
// 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 @@ static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, b
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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment