Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Aug 2014 21:06:07 +0000 (21:06 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Aug 2014 21:06:07 +0000 (21:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136082

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* platform/mac/Language.mm:
(WebCore::httpStyleLanguageCode): Replace use of WKCopyCFLocalizationPreferredName
with new WebCoreNSStringExtras helper.
* platform/mac/WebCoreNSStringExtras.mm: Replacements for the aspects of
WKCopyCFLocalizationPreferredName.
(preferredBundleLocalizationName): New helper - most preferred localization available
in the main bundle, canonicalized the way we like it.
(canonicalLocalizationName): Convert a lcalization name to a string with language and
country code, using default if necessary (e.g. "en" maps to "en_US").
* WebCore.order: Remove mention of WKCopyCFLocalizationPreferredName.
* WebCore.exp.in: ditto; also export preferredBundleLocalizationName for WebKit(2).
* platform/ios/WebCoreSystemInterfaceIOS.mm: ditto
* platform/mac/WebCoreSystemInterface.h: ditto
* platform/mac/WebCoreSystemInterface.mm: ditto
* platform/spi/cf: Added.
* platform/spi/cf/CFLocaleSPI.h: Added. Declare
CFLocaleGetLanguageRegionEncodingForLocaleIdentifier.

Source/WebKit/mac:

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::spawnPluginHost): Get current
localization name using WebCore helper instead of SPI.
* Plugins/WebBasePluginPackage.mm: Fixed the include style for this
file.
(-[WebBasePluginPackage getPluginInfoFromPLists]): Get current
localization name using WebCore helper instead of SPI.
(+[WebBasePluginPackage preferredLocalizationName]): Deleted. This
helper no longer pulls its weight.
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Remove mention of
WKCopyCFLocalizationPreferredName.
* WebKit.order: ditto

Source/WebKit2:

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService): Remove accidental leftover retrieval
of the localization.
(WebKit::createProcess): Get current localization name from
CFBundle API instead of using SPI.
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Remove mention of WKCopyCFLocalizationPreferredName
* mac/WebKit2.order: ditto

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172975 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.order
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm
Source/WebCore/platform/mac/Language.mm
Source/WebCore/platform/mac/WebCoreNSStringExtras.h
Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/spi/cf/CFLocaleSPI.h [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKit/mac/Plugins/WebBasePluginPackage.mm
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit/mac/WebKit.order
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
Source/WebKit2/mac/WebKit2.order

index 16e7098..e8895a0 100644 (file)
@@ -1,3 +1,28 @@
+2014-08-25  Maciej Stachowiak  <mjs@apple.com>
+
+        Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API
+        https://bugs.webkit.org/show_bug.cgi?id=136082
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/mac/Language.mm:
+        (WebCore::httpStyleLanguageCode): Replace use of WKCopyCFLocalizationPreferredName
+        with new WebCoreNSStringExtras helper.
+        * platform/mac/WebCoreNSStringExtras.mm: Replacements for the aspects of
+        WKCopyCFLocalizationPreferredName.
+        (preferredBundleLocalizationName): New helper - most preferred localization available
+        in the main bundle, canonicalized the way we like it.
+        (canonicalLocalizationName): Convert a lcalization name to a string with language and
+        country code, using default if necessary (e.g. "en" maps to "en_US").
+        * WebCore.order: Remove mention of WKCopyCFLocalizationPreferredName.
+        * WebCore.exp.in: ditto; also export preferredBundleLocalizationName for WebKit(2).
+        * platform/ios/WebCoreSystemInterfaceIOS.mm: ditto
+        * platform/mac/WebCoreSystemInterface.h: ditto
+        * platform/mac/WebCoreSystemInterface.mm: ditto
+        * platform/spi/cf: Added.
+        * platform/spi/cf/CFLocaleSPI.h: Added. Declare
+        CFLocaleGetLanguageRegionEncodingForLocaleIdentifier.
+
 2014-08-26  Zoltan Horvath  <zoltan@webkit.org>
 
         [CSS Shapes] Positioned polygon reftests failing
index f5330fc..916b9db 100644 (file)
@@ -2077,6 +2077,7 @@ _filenameByFixingIllegalCharacters
 _hasCaseInsensitivePrefix
 _hasCaseInsensitiveSubstring
 _hasCaseInsensitiveSuffix
+_preferredBundleLocalizationName
 _stringIsCaseInsensitiveEqualToString
 _suggestedFilenameWithMIMEType
 _wkCALayerEnumerateRectsBeingDrawnWithBlock
@@ -2087,7 +2088,6 @@ _wkCGContextResetClip
 _wkCGPathAddRoundedRect
 _wkCGPatternCreateWithImageAndTransform
 _wkCTRunGetInitialAdvance
-_wkCopyCFLocalizationPreferredName
 _wkCopyCFURLResponseSuggestedFilename
 _wkCopyCONNECTProxyResponse
 _wkCopyHTTPCookieStorage
index f445bc4..559f55d 100644 (file)
@@ -30590,7 +30590,6 @@ _wkCGContextGetShouldSmoothFonts
 _wkCGContextResetClip
 _wkCGContextDrawsWithCorrectShadowOffsets
 _wkCGPatternCreateWithImageAndTransform
-_wkCopyCFLocalizationPreferredName
 _wkCopyNSURLResponseStatusLine
 _wkCopyNSURLResponseCertificateChain
 _wkDrawBezeledTextFieldCell
index c297656..a192bc6 100644 (file)
                63189AE20E83A33300012E41 /* NodeRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRareData.h; sourceTree = "<group>"; };
                637B7ADE0E8767B800E32194 /* ElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementRareData.h; sourceTree = "<group>"; };
                63D7B32C0E78CD3F00F7617C /* NodeRenderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRenderStyle.h; sourceTree = "<group>"; };
+               65086DA719AC1719009AF46B /* CFLocaleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFLocaleSPI.h; sourceTree = "<group>"; };
                650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; };
                650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGHKernElement.cpp; sourceTree = "<group>"; };
                650FBF280D9AF047008FC292 /* SVGHKernElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGHKernElement.h; sourceTree = "<group>"; };
                        path = plugins;
                        sourceTree = "<group>";
                };
+               65086DA619AC1719009AF46B /* cf */ = {
+                       isa = PBXGroup;
+                       children = (
+                               65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
+                       );
+                       path = cf;
+                       sourceTree = "<group>";
+               };
                653EF83619A043AE0052202C /* spi */ = {
                        isa = PBXGroup;
                        children = (
+                               65086DA619AC1719009AF46B /* cf */,
                                653EF83719A043AE0052202C /* cocoa */,
                        );
                        path = spi;
index 921fb84..cb00173 100644 (file)
@@ -30,7 +30,6 @@ WEBCORE_EXPORT void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGC
 WEBCORE_EXPORT BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
 WEBCORE_EXPORT CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
 WEBCORE_EXPORT void (*wkCGContextResetClip)(CGContextRef);
-WEBCORE_EXPORT CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
 WEBCORE_EXPORT void (*wkClearGlyphVector)(void* glyphs);
 WEBCORE_EXPORT OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
 WEBCORE_EXPORT NSString* (*wkGetMIMETypeForExtension)(NSString*);
index bc72c49..fa2542b 100644 (file)
@@ -27,7 +27,7 @@
 #import "Language.h"
 
 #import "BlockExceptions.h"
-#import "WebCoreSystemInterface.h"
+#import "WebCoreNSStringExtras.h"
 #import <mutex>
 #import <wtf/Assertions.h>
 #import <wtf/NeverDestroyed.h>
@@ -77,25 +77,9 @@ static Vector<String>& preferredLanguages()
 
 namespace WebCore {
 
-static String httpStyleLanguageCode(NSString *languageCode)
+static String httpStyleLanguageCode(NSString *language)
 {
-    // Look up the language code using CFBundle.
-    RetainPtr<CFStringRef> preferredLanguageCode = adoptCF(wkCopyCFLocalizationPreferredName((CFStringRef)languageCode));
-
-    if (preferredLanguageCode)
-        languageCode = (NSString *)preferredLanguageCode.get();
-
-    // Make the string lowercase.
-    NSString *lowercaseLanguageCode = [languageCode lowercaseString];
-
-    // Turn a '_' into a '-' if it appears after a 2-letter language code.
-    if ([lowercaseLanguageCode length] >= 3 && [lowercaseLanguageCode characterAtIndex:2] == '_') {
-        RetainPtr<NSMutableString> mutableLanguageCode = adoptNS([lowercaseLanguageCode mutableCopy]);
-        [mutableLanguageCode.get() replaceCharactersInRange:NSMakeRange(2, 1) withString:@"-"];
-        return mutableLanguageCode.get();
-    }
-
-    return lowercaseLanguageCode;
+    return [[NSLocale canonicalLanguageIdentifierFromString:canonicalLocaleName(language)] lowercaseString];
 }
 
 Vector<String> platformUserPreferredLanguages()
index d535990..09d0886 100644 (file)
@@ -48,6 +48,9 @@ NSString *filenameByFixingIllegalCharacters(NSString *);
 CFStringEncoding stringEncodingForResource(Handle resource);
 #endif
 
+NSString *preferredBundleLocalizationName();
+NSString *canonicalLocaleName(NSString *);
+
 #ifdef __cplusplus
 }
 #endif
index 129ec26..2a7aec6 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "config.h"
 #import "WebCoreNSStringExtras.h"
+#import "CFLocaleSPI.h"
 
 #import <wtf/RetainPtr.h>
 
@@ -127,3 +128,32 @@ CFStringEncoding stringEncodingForResource(Handle resource)
 #endif
 
 #endif // !PLATFORM(IOS)
+
+
+
+NSString *preferredBundleLocalizationName()
+{
+    // FIXME: Any use of this function to pass localizations to another
+    // process is likely not completely right, since it only considers
+    // one localization.
+    NSArray *preferredLocalizations = [[NSBundle mainBundle] preferredLocalizations];
+    if (!preferredLocalizations || ![preferredLocalizations count])
+        return @"en_US";
+
+    return canonicalLocaleName([preferredLocalizations objectAtIndex:0]);
+}
+
+NSString *canonicalLocaleName(NSString *language)
+{
+    // FIXME: <rdar://problem/18083880> Replace use of Script Manager
+    // to canonicalize locales with a custom Web-specific table
+    LangCode languageCode;
+    RegionCode regionCode;
+
+    Boolean success = CFLocaleGetLanguageRegionEncodingForLocaleIdentifier((CFStringRef)language, &languageCode, &regionCode, nullptr, nullptr);
+    if (!success)
+        return @"en_US";
+
+    RetainPtr<CFStringRef> code = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(0, languageCode, regionCode));
+    return (NSString *)code.autorelease();
+}
index b0f7732..0ae5d38 100644 (file)
@@ -149,7 +149,6 @@ extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadS
     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
     void *context);
-extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
 extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
 extern CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
 extern CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
index cbd6333..1a23acb 100644 (file)
@@ -35,7 +35,6 @@ void (*wkCGContextResetClip)(CGContextRef);
 bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
 #endif
 CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
-CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
 CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
 CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
diff --git a/Source/WebCore/platform/spi/cf/CFLocaleSPI.h b/Source/WebCore/platform/spi/cf/CFLocaleSPI.h
new file mode 100644 (file)
index 0000000..3d1a185
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CFLocaleSPI_h
+#define CFLocaleSPI_h
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <CoreFoundation/CFPriv.h>
+#endif
+
+extern "C" {
+// FIXME: <rdar://problem/18128192> Make CFLocaleGetLanguageRegionEncodingForLocaleIdentifier public API
+// FIXME: <rdar://problem/18083880> Replace use of Script Manager to canonicalize locales with a custom Web-specific table
+Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef locale, LangCode*, RegionCode*, ScriptCode*, CFStringEncoding*);
+}
+
+#endif
index 75a717b..42aef4f 100644 (file)
@@ -1,3 +1,24 @@
+2014-08-25  Maciej Stachowiak  <mjs@apple.com>
+
+        Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API
+        https://bugs.webkit.org/show_bug.cgi?id=136082
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::NetscapePluginHostManager::spawnPluginHost): Get current
+        localization name using WebCore helper instead of SPI.
+        * Plugins/WebBasePluginPackage.mm: Fixed the include style for this 
+        file.
+        (-[WebBasePluginPackage getPluginInfoFromPLists]): Get current
+        localization name using WebCore helper instead of SPI.
+        (+[WebBasePluginPackage preferredLocalizationName]): Deleted. This
+        helper no longer pulls its weight.
+        * WebCoreSupport/WebSystemInterface.mm: 
+        (InitWebCoreSystemInterface): Remove mention of
+        WKCopyCFLocalizationPreferredName.
+        * WebKit.order: ditto
+
 2014-08-25  Daniel Bates  <dabates@apple.com>
 
         Attempt to fix the iOS build after <http://trac.webkit.org/changeset/172889>
index f168a7a..ecfb34c 100644 (file)
@@ -32,6 +32,7 @@
 #import "WebLocalizableStringsInternal.h"
 #import "WebKitSystemInterface.h"
 #import "WebNetscapePluginPackage.h"
+#import <WebCore/WebCoreNSStringExtras.h>
 #import <mach/mach_port.h>
 #import <servers/bootstrap.h>
 #import <spawn.h>
@@ -113,12 +114,10 @@ bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_ty
     NSString *pluginHostAppPath = [[NSBundle bundleForClass:[WebNetscapePluginPackage class]] pathForAuxiliaryExecutable:pluginHostAppName];
     NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath];
 
-    RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(NULL));
-    
     NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
                                       pluginHostAppExecutablePath, @"pluginHostPath",
                                       [NSNumber numberWithInt:pluginArchitecture], @"cpuType",
-                                      (NSString *)localization.get(), @"localization",
+                                      preferredBundleLocalizationName(), @"localization",
                                       nil];
 
     NSData *data = [NSPropertyListSerialization dataWithPropertyList:launchProperties format:NSPropertyListBinaryFormat_v1_0 options:0 error:nullptr];
index bc13dc8..a4820d8 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKitLegacy/WebBasePluginPackage.h>
+#import "WebBasePluginPackage.h"
 
-#import <algorithm>
+#import "WebKitLogging.h"
+#import "WebKitNSStringExtras.h"
+#import "WebNetscapePluginPackage.h"
+#import "WebPluginPackage.h"
+#import "WebTypesInternal.h"
+#import <WebCore/WebCoreNSStringExtras.h>
 #import <WebCore/WebCoreObjCExtras.h>
-#import <WebKitLegacy/WebKitNSStringExtras.h>
-#import <WebKitLegacy/WebNetscapePluginPackage.h>
-#import <WebKitLegacy/WebPluginPackage.h>
+#import <algorithm>
+#import <mach-o/arch.h>
+#import <mach-o/fat.h>
+#import <mach-o/loader.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/Assertions.h>
 #import <wtf/MainThread.h>
 #import <wtf/Vector.h>
 #import <wtf/text/CString.h>
 
-#import <WebKitSystemInterface.h>
-
-#import "WebKitLogging.h"
-#import "WebTypesInternal.h"
-
-#import <mach-o/arch.h>
-#import <mach-o/fat.h>
-#import <mach-o/loader.h>
 
 #define JavaCocoaPluginIdentifier   "com.apple.JavaPluginCocoa"
 #define JavaCarbonPluginIdentifier  "com.apple.JavaAppletPlugin"
@@ -90,11 +88,6 @@ using namespace WebCore;
     return [pluginPackage autorelease];
 }
 
-+ (NSString *)preferredLocalizationName
-{
-    return CFBridgingRelease(WKCopyCFLocalizationPreferredName(NULL));
-}
-
 #if COMPILER(CLANG)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -196,7 +189,7 @@ static NSString *pathByResolvingSymlinksAndAliases(NSString *thePath)
         if (pList) {
             // If the plist isn't localized, have the plug-in recreate it in the preferred language.
             NSString *localizationName = [pList objectForKey:WebPluginLocalizationNameKey];
-            if (![localizationName isEqualToString:[[self class] preferredLocalizationName]])
+            if (![localizationName isEqualToString:preferredBundleLocalizationName()])
                 pList = [self pListForPath:pListPath createFile:YES];
             MIMETypes = [pList objectForKey:WebPluginMIMETypesKey];
         } else
index f3b82d9..44315ef 100644 (file)
@@ -57,7 +57,6 @@ void InitWebCoreSystemInterface(void)
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     INIT(CTFontTransformGlyphs);
 #endif
-    INIT(CopyCFLocalizationPreferredName);
     INIT(CopyCONNECTProxyResponse);
     INIT(CopyNSURLResponseStatusLine);
     INIT(CopyNSURLResponseCertificateChain);
index ad880a1..6f1c2ca 100644 (file)
@@ -26,7 +26,6 @@ __Z26InitWebCoreSystemInterfacev
 +[WebView _shouldAutomaticDashSubstitutionBeEnabled]
 +[WebView _shouldAutomaticTextReplacementBeEnabled]
 +[WebView _shouldAutomaticSpellingCorrectionBeEnabled]
-_WKCopyCFLocalizationPreferredName
 +[WebView(WebPrivate) _setDomainRelaxationForbidden:forURLScheme:]
 +[WebView(WebPrivate) _registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:]
 +[WebView(WebPrivate) _registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing:]
@@ -849,7 +848,6 @@ __ZN3WTF6VectorINS_6StringELm0ENS_15CrashOnOverflowEEC2ERKS3_
 __ZN7WebCore13MimeClassInfoD2Ev
 -[WebBasePluginPackage isNativeLibraryData:]
 -[WebBasePluginPackage pListForPath:createFile:]
-+[WebBasePluginPackage preferredLocalizationName]
 -[WebPluginDatabase(Internal) _addPlugin:]
 -[WebBasePluginPackage path]
 -[WebBasePluginPackage wasAddedToPluginDatabase:]
index 51122d5..ef97837 100644 (file)
@@ -1,3 +1,19 @@
+2014-08-25  Maciej Stachowiak  <mjs@apple.com>
+
+        Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API
+        https://bugs.webkit.org/show_bug.cgi?id=136082
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::connectToService): Remove accidental leftover retrieval
+        of the localization.
+        (WebKit::createProcess): Get current localization name from
+        CFBundle API instead of using SPI.
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Remove mention of WKCopyCFLocalizationPreferredName
+        * mac/WebKit2.order: ditto
+
 2014-08-26  Dana Burkart  <dburkart@apple.com>
 
         The UNUSED_PARAM macros in ServicesOverlayController.mm are causing ASan build failures.
index d0c9d7c..8e32a3b 100644 (file)
@@ -28,8 +28,8 @@
 
 #import "DynamicLinkerEnvironmentExtractor.h"
 #import "EnvironmentVariables.h"
-#import "WebKitSystemInterface.h"
 #import <WebCore/SoftLinking.h>
+#import <WebCore/WebCoreNSStringExtras.h>
 #import <crt_externs.h>
 #import <mach-o/dyld.h>
 #import <mach/machine.h>
@@ -210,8 +210,7 @@ static void connectToService(const ProcessLauncher::LaunchOptions& launchOptions
     // 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.
-    RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(0));
-    if (localization && _CFBundleSetupXPCBootstrapPtr()) {
+    if (_CFBundleSetupXPCBootstrapPtr()) {
         auto initializationMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0));
         _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get());
         xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
@@ -457,7 +456,7 @@ static void createProcess(const ProcessLauncher::LaunchOptions& launchOptions, b
     // 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();
+    CString appleLanguagesArgument = String("('" + String(preferredBundleLocalizationName()) + "')").utf8();
 
     Vector<const char*> args;
     args.append([processAppExecutablePath fileSystemRepresentation]);
index f9e0716..4f6e3f8 100644 (file)
@@ -40,7 +40,6 @@ void InitWebCoreSystemInterface(void)
         INIT(AdvanceDefaultButtonPulseAnimation);
 #endif
         INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
-        INIT(CopyCFLocalizationPreferredName);
         INIT(CGContextGetShouldSmoothFonts);
         INIT(CGPatternCreateWithImageAndTransform);
         INIT(CGContextResetClip);
index 70ca41f..444b5f2 100644 (file)
@@ -3423,7 +3423,6 @@ __ZN3WTF16VectorBufferBaseINS_6RefPtrIN8Messages15WebProcessProxy26GetPluginProc
 __ZN6WebKit20EnvironmentVariables11appendValueEPKcS2_c
 __ZN3WTF6VectorINSt3__14pairINS_7CStringES3_EELm0ENS_15CrashOnOverflowEED2Ev
 __ZN3WTF6VectorINSt3__14pairINS_7CStringES3_EELm0ENS_15CrashOnOverflowEE6shrinkEm
-_WKCopyCFLocalizationPreferredName
 __ZN6WebKit15ProcessLauncher19processTypeAsStringENS0_11ProcessTypeE
 __ZNK3WTF12StringAppendIPKcNS_6StringEEcvS3_Ev
 __ZN3WTF6VectorINS_7CStringELm0ENS_15CrashOnOverflowEE14appendSlowCaseIS1_EEvRKT_