[PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2017 23:14:58 +0000 (23:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2017 23:14:58 +0000 (23:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179504

Patch by Christopher Reid <chris.reid@sony.com> on 2017-11-21
Reviewed by Darin Adler.

Source/WebCore:

No new tests no change in behavior.

Removed WebCoreNSStringExtras.
Replaced calls to string helpers in WebCoreNSStringExtras with calls to WTF::String.
Moved filenameByFixingIllegalCharacters into LoaderNSURLExtras.
Moved preferredBundleLocalizationName into WebKitLegacy.

* PlatformMac.cmake: Removed WebCoreNSStringExtras.mm
* SourcesCocoa.txt: Removed WebCoreNSStringExtras.mm
* WebCore.xcodeproj/project.pbxproj: Removed WebCoreNSStringExtras
* loader/mac/LoaderNSURLExtras.h:
* loader/mac/LoaderNSURLExtras.mm:
* platform/graphics/mac/FontCacheMac.mm:
* platform/mac/PasteboardMac.mm:
* platform/mac/WebCoreNSURLExtras.mm:

Source/WebKit:

* UIProcess/Cocoa/WebViewImpl.mm:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
* UIProcess/Plugins/mac/PluginInfoStoreMac.mm:

Source/WebKitLegacy/mac:

* Misc/WebKitNSStringExtras.mm:
* Plugins/Hosted/NetscapePluginHostManager.mm:
* Plugins/WebBasePluginPackage.mm:

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformMac.cmake
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/mac/LoaderNSURLExtras.h
Source/WebCore/loader/mac/LoaderNSURLExtras.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/mac/PasteboardMac.mm
Source/WebCore/platform/mac/WebCoreNSStringExtras.h [deleted file]
Source/WebCore/platform/mac/WebCoreNSStringExtras.mm [deleted file]
Source/WebCore/platform/mac/WebCoreNSURLExtras.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Misc/WebKitNSStringExtras.mm
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKitLegacy/mac/Plugins/WebBasePluginPackage.mm

index 2facae1..0e1dec0 100644 (file)
@@ -1,3 +1,26 @@
+2017-11-21  Christopher Reid  <chris.reid@sony.com>
+
+        [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
+        https://bugs.webkit.org/show_bug.cgi?id=179504
+
+        Reviewed by Darin Adler.
+
+        No new tests no change in behavior.
+
+        Removed WebCoreNSStringExtras.
+        Replaced calls to string helpers in WebCoreNSStringExtras with calls to WTF::String.
+        Moved filenameByFixingIllegalCharacters into LoaderNSURLExtras.
+        Moved preferredBundleLocalizationName into WebKitLegacy.
+
+        * PlatformMac.cmake: Removed WebCoreNSStringExtras.mm
+        * SourcesCocoa.txt: Removed WebCoreNSStringExtras.mm
+        * WebCore.xcodeproj/project.pbxproj: Removed WebCoreNSStringExtras
+        * loader/mac/LoaderNSURLExtras.h:
+        * loader/mac/LoaderNSURLExtras.mm:
+        * platform/graphics/mac/FontCacheMac.mm:
+        * platform/mac/PasteboardMac.mm:
+        * platform/mac/WebCoreNSURLExtras.mm:
+
 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
 
         Use vImage to do alpha premultiplication/unpremultiplication in FilterEffect
index b3268df..c3d5616 100644 (file)
@@ -416,7 +416,6 @@ list(APPEND WebCore_SOURCES
     platform/mac/WebCoreFullScreenPlaceholderView.mm
     platform/mac/WebCoreFullScreenWarningView.mm
     platform/mac/WebCoreFullScreenWindow.mm
-    platform/mac/WebCoreNSStringExtras.mm
     platform/mac/WebCoreNSURLExtras.mm
     platform/mac/WebCoreObjCExtras.mm
     platform/mac/WebGLBlacklist.mm
index 584dc6d..d28deba 100644 (file)
@@ -303,7 +303,6 @@ platform/mac/PublicSuffixMac.mm
 platform/mac/SerializedPlatformRepresentationMac.mm
 platform/mac/StringUtilities.mm
 platform/mac/URLMac.mm
-platform/mac/WebCoreNSStringExtras.mm
 platform/mac/WebCoreNSURLExtras.mm
 platform/mac/WebCoreObjCExtras.mm
 
index f07acd2..8aff847 100644 (file)
                93442C9E0D2B335C00338FF9 /* HTMLTableRowsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93442C9D0D2B335C00338FF9 /* HTMLTableRowsCollection.h */; };
                934907E4125BBBC8007F23A0 /* GraphicsContextCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 934907E3125BBBC8007F23A0 /* GraphicsContextCG.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */; };
-               934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934F713A0D5A6F1000018D69 /* AuthenticationChallengeBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93500F3213FDE3BE0099EC24 /* NSScrollerImpDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */; };
                93442C9F0D2B336000338FF9 /* HTMLTableRowsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTableRowsCollection.cpp; sourceTree = "<group>"; };
                934907E3125BBBC8007F23A0 /* GraphicsContextCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextCG.h; sourceTree = "<group>"; };
                934CC1090EDB223900A658F2 /* ScriptSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceCode.h; sourceTree = "<group>"; };
-               934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSStringExtras.mm; sourceTree = "<group>"; };
-               934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreNSStringExtras.h; sourceTree = "<group>"; };
                934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallengeBase.cpp; sourceTree = "<group>"; };
                934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeBase.h; sourceTree = "<group>"; };
                934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceErrorBase.h; sourceTree = "<group>"; };
                                CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */,
                                CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */,
                                CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */,
-                               934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */,
-                               934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */,
                                C5B4C24B1509236C00A6EF37 /* WebCoreNSURLExtras.h */,
                                C5B4C24C1509236C00A6EF37 /* WebCoreNSURLExtras.mm */,
                                DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */,
                                93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
                                3140379B124BEA7F00AF40E4 /* WebCoreMotionManager.h in Headers */,
                                CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */,
-                               934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */,
                                C5B4C24D1509236C00A6EF37 /* WebCoreNSURLExtras.h in Headers */,
                                CD225C0C1C46FBF400140761 /* WebCoreNSURLSession.h in Headers */,
                                DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */,
index f63aa93..2776e2e 100644 (file)
  */
 
 #import <Foundation/Foundation.h>
+#import <wtf/Forward.h>
 
-namespace WTF {
-class String;
-}
-
-extern "C" {
 WEBCORE_EXPORT NSString *suggestedFilenameWithMIMEType(NSURL *, const WTF::String& MIMEType);
-}
+WEBCORE_EXPORT NSString *filenameByFixingIllegalCharacters(NSString *);
index c26de3e..9d951cf 100644 (file)
@@ -35,7 +35,6 @@
 #import "URL.h"
 #import "LocalizedStrings.h"
 #import "MIMETypeRegistry.h"
-#import "WebCoreNSStringExtras.h"
 #import <wtf/text/WTFString.h>
 
 using namespace WebCore;
@@ -64,8 +63,8 @@ NSString *suggestedFilenameWithMIMEType(NSURL *url, const String& mimeType)
     // Do not correct filenames that are reported with a mime type of tar, and 
     // have a filename which has .tar in it or ends in .tgz
     if ((mimeType == "application/tar" || mimeType == "application/x-tar")
-        && (hasCaseInsensitiveSubstring(filename, @".tar")
-        || hasCaseInsensitiveSuffix(filename, @".tgz"))) {
+        && (String(filename).containsIgnoringASCIICase(".tar")
+        || String(filename).endsWithIgnoringASCIICase(".tgz"))) {
         return filename;
     }
 
@@ -86,3 +85,24 @@ NSString *suggestedFilenameWithMIMEType(NSURL *url, const String& mimeType)
 
     return filename;
 }
+
+NSString *filenameByFixingIllegalCharacters(NSString *string)
+{
+    NSMutableString *filename = [[string mutableCopy] autorelease];
+
+    // Strip null characters.
+    unichar nullChar = 0;
+    [filename replaceOccurrencesOfString:[NSString stringWithCharacters:&nullChar length:0] withString:@"" options:0 range:NSMakeRange(0, [filename length])];
+
+    // Replace "/" with "-".
+    [filename replaceOccurrencesOfString:@"/" withString:@"-" options:0 range:NSMakeRange(0, [filename length])];
+
+    // Replace ":" with "-".
+    [filename replaceOccurrencesOfString:@":" withString:@"-" options:0 range:NSMakeRange(0, [filename length])];
+
+    // Strip leading dots.
+    while ([filename hasPrefix:@"."])
+        [filename deleteCharactersInRange:NSMakeRange(0, 1)];
+
+    return filename;
+}
index 4281da0..9118d8e 100644 (file)
@@ -37,7 +37,6 @@
 #import <pal/spi/cocoa/CoreTextSPI.h>
 
 #if PLATFORM(MAC)
-#import "WebCoreNSStringExtras.h"
 #import <AppKit/AppKit.h>
 #import <pal/spi/mac/NSFontSPI.h>
 #import <wtf/MainThread.h>
index 85ad5ed..ba018d2 100644 (file)
@@ -36,7 +36,6 @@
 #import "SharedBuffer.h"
 #import "URL.h"
 #import "UTIUtilities.h"
-#import "WebCoreNSStringExtras.h"
 #import "WebNSAttributedStringExtras.h"
 #import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/mac/HIServicesSPI.h>
diff --git a/Source/WebCore/platform/mac/WebCoreNSStringExtras.h b/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
deleted file mode 100644 (file)
index 81c2c96..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2005, 2007 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. 
- * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#include <objc/objc.h>
-
-#ifdef __OBJC__
-#include <Foundation/Foundation.h>
-@class NSString;
-#else
-typedef struct NSString NSString;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-WEBCORE_EXPORT BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second);
-WEBCORE_EXPORT BOOL hasCaseInsensitiveSuffix(NSString *, NSString *suffix);
-WEBCORE_EXPORT BOOL hasCaseInsensitivePrefix(NSString *, NSString *prefix);
-WEBCORE_EXPORT BOOL hasCaseInsensitiveSubstring(NSString *, NSString *substring);
-WEBCORE_EXPORT NSString *filenameByFixingIllegalCharacters(NSString *);
-
-WEBCORE_EXPORT NSString *preferredBundleLocalizationName();
-NSString *canonicalLocaleName(NSString *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm b/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
deleted file mode 100644 (file)
index 8e3cf51..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2005, 2007 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. 
- * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import "config.h"
-#import "WebCoreNSStringExtras.h"
-
-#import <pal/spi/cf/CFLocaleSPI.h>
-#import <wtf/RetainPtr.h>
-
-BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second)
-{
-    return [first compare:second options:(NSCaseInsensitiveSearch|NSLiteralSearch)] == NSOrderedSame;
-}
-
-BOOL hasCaseInsensitiveSuffix(NSString *string, NSString *suffix)
-{
-    return [string rangeOfString:suffix options:(NSCaseInsensitiveSearch | NSBackwardsSearch | NSAnchoredSearch)].location != NSNotFound;
-}
-
-BOOL hasCaseInsensitivePrefix(NSString *string, NSString *prefix)
-{
-    return [string rangeOfString:prefix options:(NSCaseInsensitiveSearch | NSAnchoredSearch)].location != NSNotFound;
-}
-
-BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring)
-{
-    return [string rangeOfString:substring options:NSCaseInsensitiveSearch].location != NSNotFound;
-}
-
-NSString *filenameByFixingIllegalCharacters(NSString *string)
-{
-    NSMutableString *filename = [[string mutableCopy] autorelease];
-
-    // Strip null characters.
-    unichar nullChar = 0;
-    [filename replaceOccurrencesOfString:[NSString stringWithCharacters:&nullChar length:0] withString:@"" options:0 range:NSMakeRange(0, [filename length])];
-
-    // Replace "/" with "-".
-    [filename replaceOccurrencesOfString:@"/" withString:@"-" options:0 range:NSMakeRange(0, [filename length])];
-
-    // Replace ":" with "-".
-    [filename replaceOccurrencesOfString:@":" withString:@"-" options:0 range:NSMakeRange(0, [filename length])];
-    
-    // Strip leading dots.
-    while ([filename hasPrefix:@"."]) {
-        [filename deleteCharactersInRange:NSMakeRange(0,1)];
-    }
-    
-    return filename;
-}
-
-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 5e6166c..a340db2 100644 (file)
@@ -29,7 +29,6 @@
 #import "config.h"
 #import "URLParser.h"
 #import "WebCoreObjCExtras.h"
-#import "WebCoreNSStringExtras.h"
 #import "WebCoreNSURLExtras.h"
 #import <wtf/Function.h>
 #import <wtf/HexNumber.h>
@@ -721,7 +720,7 @@ static void applyHostNameFunctionToURLString(NSString *string, StringRangeApplie
     
     // Maybe we should implement this using a character buffer instead?
     
-    if (hasCaseInsensitivePrefix(string, @"mailto:")) {
+    if (protocolIs(string, "mailto")) {
         applyHostNameFunctionToMailToURLString(string, f, context);
         return;
     }
index aa9076e..45b3b5a 100644 (file)
@@ -1,3 +1,14 @@
+2017-11-21  Christopher Reid  <chris.reid@sony.com>
+
+        [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
+        https://bugs.webkit.org/show_bug.cgi?id=179504
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+
 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] WPEWebProcess: Couldn't find current GLX or EGL context
index d76e109..8fb49ba 100644 (file)
@@ -75,6 +75,7 @@
 #import <WebCore/DragData.h>
 #import <WebCore/Editor.h>
 #import <WebCore/KeypressCommand.h>
+#import <WebCore/LoaderNSURLExtras.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/PlatformEventFactoryMac.h>
 #import <WebCore/TextAlternativeWithRange.h>
@@ -83,7 +84,6 @@
 #import <WebCore/WebCoreCALayerExtras.h>
 #import <WebCore/WebCoreFullScreenPlaceholderView.h>
 #import <WebCore/WebCoreFullScreenWindow.h>
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <WebCore/WebPlaybackControlsManager.h>
 #import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/cocoa/AVKitSPI.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/SetForScope.h>
 #import <wtf/SoftLinking.h>
+#import <wtf/text/StringConcatenate.h>
 
 #if HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 SOFT_LINK_FRAMEWORK(AVKit)
@@ -3797,11 +3798,10 @@ void WebViewImpl::dragImageForView(NSView *view, NSImage *image, CGPoint clientP
 #pragma clang diagnostic pop
 }
 
-static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension)
+static bool matchesExtensionOrEquivalent(const String& filename, const String& extension)
 {
-    NSString *extensionAsSuffix = [@"." stringByAppendingString:extension];
-    return hasCaseInsensitiveSuffix(filename, extensionAsSuffix) || (stringIsCaseInsensitiveEqualToString(extension, @"jpeg")
-        && hasCaseInsensitiveSuffix(filename, @".jpg"));
+    return filename.endsWithIgnoringASCIICase("." + extension)
+        || (equalLettersIgnoringASCIICase(extension, "jpeg") && filename.endsWithIgnoringASCIICase(".jpg"));
 }
 
 void WebViewImpl::setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *pasteboard)
index 6ff7356..f19899b 100644 (file)
@@ -26,7 +26,6 @@
 #import "config.h"
 #import "ProcessLauncher.h"
 
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <crt_externs.h>
 #import <mach-o/dyld.h>
 #import <mach/machine.h>
index ef1f4b1..54b6125 100644 (file)
@@ -32,7 +32,6 @@
 #import "NetscapePluginModule.h"
 #import "SandboxUtilities.h"
 #import <WebCore/PluginBlacklist.h>
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <wtf/HashSet.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/text/CString.h>
index 9de4c17..ecdb86e 100644 (file)
@@ -1,3 +1,14 @@
+2017-11-21  Christopher Reid  <chris.reid@sony.com>
+
+        [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
+        https://bugs.webkit.org/show_bug.cgi?id=179504
+
+        Reviewed by Darin Adler.
+
+        * Misc/WebKitNSStringExtras.mm:
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        * Plugins/WebBasePluginPackage.mm:
+
 2017-11-19  Tim Horton  <timothy_horton@apple.com>
 
         Remove unused TOUCH_ICON_LOADING feature flag
index b645f3b..0fa9979 100644 (file)
@@ -30,8 +30,8 @@
 
 #import <WebCore/FontCascade.h>
 #import <WebCore/GraphicsContext.h>
+#import <WebCore/LoaderNSURLExtras.h>
 #import <WebCore/TextRun.h>
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <WebKitLegacy/WebNSFileManagerExtras.h>
 #import <WebKitLegacy/WebNSObjectExtras.h>
 #import <pal/spi/cg/CoreGraphicsSPI.h>
@@ -174,22 +174,22 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
 
 - (BOOL)_webkit_isCaseInsensitiveEqualToString:(NSString *)string
 {
-    return stringIsCaseInsensitiveEqualToString(self, string);
+    return [self compare:string options:(NSCaseInsensitiveSearch | NSLiteralSearch)] == NSOrderedSame;
 }
 
 -(BOOL)_webkit_hasCaseInsensitivePrefix:(NSString *)prefix
 {
-    return hasCaseInsensitivePrefix(self, prefix);
+    return [self rangeOfString:prefix options:(NSCaseInsensitiveSearch | NSAnchoredSearch)].location != NSNotFound;
 }
 
 -(BOOL)_webkit_hasCaseInsensitiveSuffix:(NSString *)suffix
 {
-    return hasCaseInsensitiveSuffix(self, suffix);
+    return [self rangeOfString:suffix options:(NSCaseInsensitiveSearch | NSBackwardsSearch | NSAnchoredSearch)].location != NSNotFound;
 }
 
 -(BOOL)_webkit_hasCaseInsensitiveSubstring:(NSString *)substring
 {
-    return hasCaseInsensitiveSubstring(self, substring);
+    return [self rangeOfString:substring options:NSCaseInsensitiveSearch].location != NSNotFound;
 }
 
 -(NSString *)_webkit_filenameByFixingIllegalCharacters
index d64e85c..9ec5478 100644 (file)
@@ -31,8 +31,8 @@
 #import "NetscapePluginInstanceProxy.h"
 #import "WebLocalizableStringsInternal.h"
 #import "WebNetscapePluginPackage.h"
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <mach/mach_port.h>
+#import <pal/spi/cf/CFLocaleSPI.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <pal/spi/cocoa/ServersSPI.h>
 #import <spawn.h>
@@ -100,6 +100,30 @@ NetscapePluginHostProxy* NetscapePluginHostManager::hostForPlugin(const WTF::Str
     return hostProxy;
 }
 
+static 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";
+
+    NSString *language = [preferredLocalizations objectAtIndex:0];
+
+    // 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";
+
+    auto code = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(0, languageCode, regionCode));
+    return (NSString *)code.autorelease();
+}
+
 bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN)
 {
     if (m_pluginVendorPort == MACH_PORT_NULL) {
index fd67437..ca20313 100644 (file)
@@ -33,7 +33,6 @@
 #import "WebNetscapePluginPackage.h"
 #import "WebPluginPackage.h"
 #import "WebTypesInternal.h"
-#import <WebCore/WebCoreNSStringExtras.h> 
 #import <WebCore/WebCoreObjCExtras.h>
 #import <algorithm>
 #import <mach-o/arch.h>