Changeset 170653 in webkit


Ignore:
Timestamp:
Jul 1, 2014 11:41:27 AM (10 years ago)
Author:
timothy_horton@apple.com
Message:

[Cocoa] WebProcess doesn't follow localization of UI process when run as a service
https://bugs.webkit.org/show_bug.cgi?id=133126
<rdar://problem/13396515>

Patch by Alexey Proskuryakov.
Reviewed by Tim Horton.

  • Configurations/WebContentService.Development.xcconfig:
  • Configurations/WebContentService.xcconfig:

Figure out which of the two keys to use. CFBundleAllowMixedLocalizations was
a workaround before we got CFBundleFollowParentLocalization, and these cannot be
used together.

  • UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::connectToService): Set up

XPC bootstrap for CFBundle to use.

  • WebKit2.xcodeproj/project.pbxproj: Added a script that applies the key to Info.plist.
  • WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-OSX.plist:
  • WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist:
  • WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
  • WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:

Removed CFBundleAllowMixedLocalizations, we now add it programmatically.

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r170652 r170653  
     12014-07-01  Alexey Proskuryakov  <ap@apple.com>
     2
     3        [Cocoa] WebProcess doesn't follow localization of UI process when run as a service
     4        https://bugs.webkit.org/show_bug.cgi?id=133126
     5        <rdar://problem/13396515>
     6
     7        Patch by Alexey Proskuryakov.
     8        Reviewed by Tim Horton.
     9
     10        * Configurations/WebContentService.Development.xcconfig:
     11        * Configurations/WebContentService.xcconfig:
     12        Figure out which of the two keys to use. CFBundleAllowMixedLocalizations was
     13        a workaround before we got CFBundleFollowParentLocalization, and these cannot be
     14        used together.
     15
     16        * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::connectToService): Set up
     17        XPC bootstrap for CFBundle to use.
     18
     19        * WebKit2.xcodeproj/project.pbxproj: Added a script that applies the key to Info.plist.
     20
     21        * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-OSX.plist:
     22        * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist:
     23        * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
     24        * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
     25        Removed CFBundleAllowMixedLocalizations, we now add it programmatically.
     26
    1272014-07-01  Alex Christensen  <achristensen@webkit.org>
    228
  • trunk/Source/WebKit2/Configurations/WebContentService.Development.xcconfig

    r167543 r170653  
    1 // Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     1// Copyright (C) 2012-2014 Apple Inc. All rights reserved.
    22//
    33// Redistribution and use in source and binary forms, with or without
     
    3232INFOPLIST_FILE_iphonesimulator = $(INFOPLIST_FILE_iphoneos);
    3333
     34BUNDLE_LOCALIZATION_KEY = $(BUNDLE_LOCALIZATION_KEY_$(PLATFORM_NAME));
     35BUNDLE_LOCALIZATION_KEY_iphoneos = CFBundleFollowParentLocalization;
     36BUNDLE_LOCALIZATION_KEY_iphonesimulator = CFBundleFollowParentLocalization;
     37BUNDLE_LOCALIZATION_KEY_macosx = $(BUNDLE_LOCALIZATION_KEY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
     38BUNDLE_LOCALIZATION_KEY_macosx_1080 = CFBundleAllowMixedLocalizations;
     39BUNDLE_LOCALIZATION_KEY_macosx_1090 = CFBundleAllowMixedLocalizations;
     40BUNDLE_LOCALIZATION_KEY_macosx_101000 = CFBundleFollowParentLocalization;
     41
    3442CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*] = Configurations/WebContent-iOS.entitlements
    3543
  • trunk/Source/WebKit2/Configurations/WebContentService.xcconfig

    r167543 r170653  
    1 // Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     1// Copyright (C) 2012-2014 Apple Inc. All rights reserved.
    22//
    33// Redistribution and use in source and binary forms, with or without
     
    3232INFOPLIST_FILE_iphonesimulator = $(INFOPLIST_FILE_iphoneos);
    3333
     34BUNDLE_LOCALIZATION_KEY = $(BUNDLE_LOCALIZATION_KEY_$(PLATFORM_NAME));
     35BUNDLE_LOCALIZATION_KEY_iphoneos = CFBundleFollowParentLocalization;
     36BUNDLE_LOCALIZATION_KEY_iphonesimulator = CFBundleFollowParentLocalization;
     37BUNDLE_LOCALIZATION_KEY_macosx = $(BUNDLE_LOCALIZATION_KEY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
     38BUNDLE_LOCALIZATION_KEY_macosx_1080 = CFBundleAllowMixedLocalizations;
     39BUNDLE_LOCALIZATION_KEY_macosx_1090 = CFBundleAllowMixedLocalizations;
     40BUNDLE_LOCALIZATION_KEY_macosx_101000 = CFBundleFollowParentLocalization;
     41
    3442CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*] = Configurations/WebContent-iOS.entitlements
    3543
  • trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r169663 r170653  
    11/*
    2  * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#import "EnvironmentVariables.h"
    3131#import "WebKitSystemInterface.h"
     32#import <WebCore/SoftLinking.h>
    3233#import <crt_externs.h>
    3334#import <mach-o/dyld.h>
     
    4546#import <xpc/xpc.h>
    4647
     48#if __has_include(<xpc/private.h>)
     49#import <xpc/private.h>
     50#endif
     51
    4752// FIXME: We should be doing this another way.
    4853extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t);
     
    5055extern "C" void xpc_connection_set_instance(xpc_connection_t, uuid_t);
    5156extern "C" void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t);
     57
     58#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
     59extern "C" void xpc_connection_set_bootstrap(xpc_connection_t connection, xpc_object_t bootstrap);
     60
     61// FIXME: Soft linking is temporary, make this into a regular function call once this function is available everywhere we need.
     62SOFT_LINK_FRAMEWORK(CoreFoundation)
     63SOFT_LINK_OPTIONAL(CoreFoundation, _CFBundleSetupXPCBootstrap, void, unused, (xpc_object_t))
     64
     65#endif
    5266
    5367namespace WebKit {
     
    192206    xpc_connection_set_instance(connection.get(), instanceUUID->uuid);
    193207
     208#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
     209    // Inherit UI process localization. It can be different from child process default localization:
     210    // 1. When the application and system frameworks simply have different localized resources available, we should match the application.
     211    // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
     212    // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
     213    RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(0));
     214    if (localization && _CFBundleSetupXPCBootstrapPtr()) {
     215        auto initializationMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0));
     216        _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get());
     217        xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
     218    }
     219#endif
     220
    194221    // XPC requires having an event handler, even if it is not used.
    195222    xpc_connection_set_event_handler(connection.get(), ^(xpc_object_t event) { });
     
    212239    CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname();
    213240
     241    // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need.
    214242    auto bootstrapMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0));
    215243    xpc_dictionary_set_string(bootstrapMessage.get(), "message-name", "bootstrap");
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r170640 r170653  
    80188018                                BCDC308D15FDB99A006B6695 /* Frameworks */,
    80198019                                BC3DE46415A91763008D26FC /* Resources */,
     8020                                E19C7DDB194A5E9100F1866F /* Add CFBundle Localization Info.plist Key */,
    80208021                        );
    80218022                        buildRules = (
     
    81268127                                BCAE9DE6160C097400A33217 /* Frameworks */,
    81278128                                BCAE9DE7160C097400A33217 /* Resources */,
     8129                                E19C7DDA194A4C9500F1866F /* Add CFBundle Localization Info.plist Key */,
    81288130                        );
    81298131                        buildRules = (
     
    86248626                        shellPath = /bin/sh;
    86258627                        shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ ! $CC ]; then\n    export CC=\"`xcrun -find clang`\"\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n    make --no-builtin-rules -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.activecpu` SDKROOT=${SDKROOT}\nfi\n";
     8628                };
     8629                E19C7DDA194A4C9500F1866F /* Add CFBundle Localization Info.plist Key */ = {
     8630                        isa = PBXShellScriptBuildPhase;
     8631                        buildActionMask = 2147483647;
     8632                        files = (
     8633                        );
     8634                        inputPaths = (
     8635                        );
     8636                        name = "Add CFBundle Localization Info.plist Key";
     8637                        outputPaths = (
     8638                        );
     8639                        runOnlyForDeploymentPostprocessing = 0;
     8640                        shellPath = /bin/sh;
     8641                        shellScript = "/usr/libexec/PlistBuddy -c \"Print :$BUNDLE_LOCALIZATION_KEY\" $TARGET_BUILD_DIR/$INFOPLIST_PATH >/dev/null 2>/dev/null\nif [[ $? != 0 ]]; then\n    echo \"Updating the Info.plist key\"\n    /usr/libexec/PlistBuddy -c \"Delete :CFBundleAllowMixedLocalizations\" $TARGET_BUILD_DIR/$INFOPLIST_PATH 2>/dev/null\n    /usr/libexec/PlistBuddy -c \"Delete :CFBundleFollowParentLocalization\" $TARGET_BUILD_DIR/$INFOPLIST_PATH 2>/dev/null\n    /usr/libexec/PlistBuddy -c \"Add :$BUNDLE_LOCALIZATION_KEY bool true\" $TARGET_BUILD_DIR/$INFOPLIST_PATH\n    echo \"Done\"\nfi\n";
     8642                        showEnvVarsInLog = 0;
     8643                };
     8644                E19C7DDB194A5E9100F1866F /* Add CFBundle Localization Info.plist Key */ = {
     8645                        isa = PBXShellScriptBuildPhase;
     8646                        buildActionMask = 2147483647;
     8647                        files = (
     8648                        );
     8649                        inputPaths = (
     8650                        );
     8651                        name = "Add CFBundle Localization Info.plist Key";
     8652                        outputPaths = (
     8653                        );
     8654                        runOnlyForDeploymentPostprocessing = 0;
     8655                        shellPath = /bin/sh;
     8656                        shellScript = "/usr/libexec/PlistBuddy -c \"Print :$BUNDLE_LOCALIZATION_KEY\" $TARGET_BUILD_DIR/$INFOPLIST_PATH >/dev/null 2>/dev/null\nif [[ $? != 0 ]]; then\n    echo \"Updating the Info.plist key\"\n    /usr/libexec/PlistBuddy -c \"Delete :CFBundleAllowMixedLocalizations\" $TARGET_BUILD_DIR/$INFOPLIST_PATH 2>/dev/null\n    /usr/libexec/PlistBuddy -c \"Delete :CFBundleFollowParentLocalization\" $TARGET_BUILD_DIR/$INFOPLIST_PATH 2>/dev/null\n    /usr/libexec/PlistBuddy -c \"Add :$BUNDLE_LOCALIZATION_KEY bool true\" $TARGET_BUILD_DIR/$INFOPLIST_PATH\n    echo \"Done\"\nfi\n";
     8657                        showEnvVarsInLog = 0;
    86268658                };
    86278659/* End PBXShellScriptBuildPhase section */
  • trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-OSX.plist

    r163425 r170653  
    2323        <key>CFBundleVersion</key>
    2424        <string>${BUNDLE_VERSION}</string>
    25         <key>CFBundleAllowMixedLocalizations</key>
    26         <true/>
    2725        <key>LSFileQuarantineEnabled</key>
    2826        <true/>
     
    3735        <key>NSSupportsAppNap</key>
    3836        <true/>
     37        <key>NSMainNibFile</key>
     38        <string>WebContentProcess</string>
    3939        <key>XPCService</key>
    4040        <dict>
     
    4848                <true/>
    4949        </dict>
    50         <key>NSMainNibFile</key>
    51         <string>WebContentProcess</string>
    5250</dict>
    5351</plist>
  • trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist

    r170075 r170653  
    2323        <key>CFBundleVersion</key>
    2424        <string>${BUNDLE_VERSION}</string>
    25         <key>CFBundleAllowMixedLocalizations</key>
    26         <true/>
    2725        <key>LSFileQuarantineEnabled</key>
    2826        <true/>
  • trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist

    r168541 r170653  
    2929        <key>WebKitEntryPoint</key>
    3030        <string>WebContentServiceInitializer</string>
    31         <key>CFBundleAllowMixedLocalizations</key>
    32         <true/>
    3331        <key>LSUIElement</key>
    3432        <true/>
  • trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist

    r170075 r170653  
    3636                <true/>
    3737        </dict>
    38         <key>CFBundleAllowMixedLocalizations</key>
    39         <true/>
    4038        <key>UIBackgroundModes</key>
    4139        <array>
Note: See TracChangeset for help on using the changeset viewer.