Changeset 154396 in webkit


Ignore:
Timestamp:
Aug 21, 2013, 10:25:28 AM (12 years ago)
Author:
ap@apple.com
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.
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r154373 r154396  
     12013-08-21  Alexey Proskuryakov  <ap@apple.com>
     2
     3        REGRESSION (r145458?): WebProcess doesn't respect UI process localization
     4        https://bugs.webkit.org/show_bug.cgi?id=120096
     5
     6        Reviewed by Darin Adler.
     7
     8        We used to get into a situation where CFBundle thought that we had no good localization,
     9        and used one passed as default. This is never the case with mixed localizations,
     10        so default is just ignored now.
     11
     12        I think that the previous behavior was a bit of a hack. As WebProcess is not localized,
     13        it's more honest to say that we want mixed localizations, and force the language
     14        to match UI process localization.
     15
     16        * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
     17        (WebKit::ChildProcessMain): Don't set default localization, it's not taken into
     18        consideration unless all other attempts to compute bundle localization fail.
     19
     20        * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::createProcess): Pass
     21        UI process localization as -AppleLanguages argument, so that Core Foundation uses
     22        that instead of actual user languages. We want to match UI process localization.
     23
    1242013-08-20  Gavin Barraclough  <barraclough@apple.com>
    225
  • trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h

    r149255 r154396  
    8787            return EXIT_FAILURE;
    8888
    89         // FIXME: This should be moved to ChildProcessMac if it is still necessary.
    90         String localization = commandLine["localization"];
    91         RetainPtr<CFStringRef> cfLocalization = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));
    92         if (cfLocalization)
    93             WKSetDefaultLocalization(cfLocalization.get());
    94 
    9589        ChildProcessType::shared().initialize(parameters);
    9690    }
  • trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r149933 r154396  
    384384    mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND);
    385385
    386     RetainPtr<CFStringRef> cfLocalization = adoptCF(WKCopyCFLocalizationPreferredName(NULL));
    387     CString localization = String(cfLocalization.get()).utf8();
    388 
    389386    NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"];
    390387
     
    420417    CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), that).utf8();
    421418
     419    // Inherit UI process localization. It can be different from child process default localization:
     420    // 1. When the application and system frameworks simply have different localized resources available, we should match the application.
     421    // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
     422    // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
     423    CString appleLanguagesArgument = String("('" + String(adoptCF(WKCopyCFLocalizationPreferredName(0)).get()) + "')").utf8();
     424
    422425    Vector<const char*> args;
    423426    args.append([processAppExecutablePath fileSystemRepresentation]);
     
    427430    args.append("-servicename");
    428431    args.append(serviceName.data());
    429     args.append("-localization");
    430     args.append(localization.data());
    431432    args.append("-client-identifier");
    432433    args.append(clientIdentifier.data());
    433434    args.append("-ui-process-name");
    434435    args.append([[[NSProcessInfo processInfo] processName] UTF8String]);
     436    args.append("-AppleLanguages"); // This argument will be handled by Core Foundation.
     437    args.append(appleLanguagesArgument.data());
    435438
    436439    HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin();
Note: See TracChangeset for help on using the changeset viewer.