Changeset 169122 in webkit
- Timestamp:
- May 20, 2014 11:44:52 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r169114 r169122 1 2014-05-20 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] 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 <rdar://problem/16561084> 7 8 Reviewed by Sam Weinig and Tim Horton. 9 10 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm: 11 (WebKit::handleXPCBootstrap): 12 (main): 13 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm: 14 (WebKit::handleXPCBootstrap): 15 (main): 16 Set localization very early in process lifetime (in development builds, that's 17 even before WebKit framework is loaded). 18 19 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::connectToService): 20 Pass UI process localization to the service, computing it in the same way we do 21 for child processes. 22 1 23 2014-05-20 Anders Carlsson <andersca@apple.com> 2 24 -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm
r168584 r169122 31 31 #import <stdlib.h> 32 32 #import "XPCPtr.h" 33 34 #if __has_include(<Foundation/NSPrivateDecls.h>) 35 #import <Foundation/NSPrivateDecls.h> 36 #endif 37 38 #if __has_include(<xpc/private.h>) 39 #import <xpc/private.h> 40 #endif 41 42 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 43 extern "C" xpc_object_t xpc_copy_bootstrap(); 44 #endif 45 46 @interface NSUserDefaults (Details) 47 - (void)setObject:(id)value forKey:(NSString *)defaultName inDomain:(NSString *)domain; 48 @end 33 49 34 50 namespace WebKit { … … 156 172 } 157 173 174 static void handleXPCBootstrap() 175 { 176 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 177 auto bootstrapData = IPC::adoptXPC(xpc_copy_bootstrap()); 178 const char* localization = xpc_dictionary_get_string(bootstrapData.get(), "localization"); 179 if (localization) { 180 // Do this before calling xpc_main(), so that the preference is set before any CFBundle code runs. 181 [[NSUserDefaults standardUserDefaults] setObject:@[ [NSString stringWithUTF8String:localization] ] forKey:@"AppleLanguages" inDomain:NSArgumentDomain]; 182 } 183 #endif 184 } 185 158 186 } // namespace WebKit; 159 187 … … 162 190 int main(int argc, char** argv) 163 191 { 192 handleXPCBootstrap(); 164 193 xpc_main(XPCServiceEventHandler); 165 194 return 0; -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm
r168584 r169122 26 26 #import <CoreFoundation/CoreFoundation.h> 27 27 #import "XPCPtr.h" 28 29 #if __has_include(<Foundation/NSPrivateDecls.h>) 30 #import <Foundation/NSPrivateDecls.h> 31 #endif 32 33 #if __has_include(<xpc/private.h>) 34 #import <xpc/private.h> 35 #endif 36 37 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 38 extern "C" xpc_object_t xpc_copy_bootstrap(); 39 #endif 40 41 @interface NSUserDefaults (Details) 42 - (void)setObject:(id)value forKey:(NSString *)defaultName inDomain:(NSString *)domain; 43 @end 28 44 29 45 namespace WebKit { … … 69 85 } 70 86 87 static void handleXPCBootstrap() 88 { 89 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 90 auto bootstrapData = IPC::adoptXPC(xpc_copy_bootstrap()); 91 const char* localization = xpc_dictionary_get_string(bootstrapData.get(), "localization"); 92 if (localization) { 93 // Do this before calling xpc_main(), so that the preference is set before any CFBundle code runs. 94 [[NSUserDefaults standardUserDefaults] setObject:@[ [NSString stringWithUTF8String:localization] ] forKey:@"AppleLanguages" inDomain:NSArgumentDomain]; 95 } 96 #endif 97 } 98 71 99 } // namespace WebKit 72 100 … … 75 103 int main(int argc, char** argv) 76 104 { 105 handleXPCBootstrap(); 77 106 xpc_main(XPCServiceEventHandler); 78 107 return 0; -
trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r168584 r169122 45 45 #import <xpc/xpc.h> 46 46 47 #if __has_include(<xpc/private.h>) 48 #import <xpc/private.h> 49 #endif 50 47 51 // FIXME: We should be doing this another way. 48 52 extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t); … … 50 54 extern "C" void xpc_connection_set_instance(xpc_connection_t, uuid_t); 51 55 extern "C" void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t); 56 57 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 58 extern "C" void xpc_connection_set_bootstrap(xpc_connection_t connection, xpc_object_t bootstrap); 59 #endif 52 60 53 61 namespace WebKit { … … 177 185 xpc_connection_set_instance(connection.get(), instanceUUID->uuid); 178 186 187 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100 188 // Inherit UI process localization. It can be different from child process default localization: 189 // 1. When the application and system frameworks simply have different localized resources available, we should match the application. 190 // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks. 191 // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes. 192 // FIXME: When UI process allows for mixed localizations (CFBundleAllowMixedLocalizations), we should probably send the whole AppleLanguages array. 193 RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(0)); 194 if (localization) { 195 auto initializationMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0)); 196 xpc_dictionary_set_string(initializationMessage.get(), "localization", String(localization.get()).ascii().data()); 197 xpc_connection_set_bootstrap(connection.get(), initializationMessage.get()); 198 } 199 #endif 200 179 201 // XPC requires having an event handler, even if it is not used. 180 202 xpc_connection_set_event_handler(connection.get(), ^(xpc_object_t event) { }); … … 200 222 CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); 201 223 224 // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need. 202 225 auto bootstrapMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0)); 203 226 xpc_dictionary_set_string(bootstrapMessage.get(), "message-name", "bootstrap"); -
trunk/Tools/ChangeLog
r169113 r169122 1 2014-05-20 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] 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 <rdar://problem/16561084> 7 8 Reviewed by Sam Weinig and Tim Horton. 9 10 * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm: 11 (WTR::InjectedBundle::platformInitialize): It was too late to override language 12 here, and it's not necessary any more. Keeping the code for older OS versions in 13 case it did have effect in some code paths. 14 1 15 2014-05-19 David Farler <dfarler@apple.com> 2 16 -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm
r158326 r169122 55 55 @"NSOverlayScrollersEnabled": @NO, 56 56 @"AppleShowScrollBars": @"Always", 57 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 57 58 // FIXME (<rdar://problem/13396515>): It is too late to set AppleLanguages here, as loaded frameworks localizations cannot be changed. 58 59 // This breaks some accessibility tests on machines with non-English user language. 59 60 @"AppleLanguages": @[ @"en" ], 61 #endif 60 62 // FIXME: Why does this dictionary not match the one in DumpRenderTree? 61 63 @"NSTestCorrectionDictionary": @{
Note: See TracChangeset
for help on using the changeset viewer.