Title: [213319] trunk
Revision
213319
Author
aakash_j...@apple.com
Date
2017-03-02 15:56:03 -0800 (Thu, 02 Mar 2017)

Log Message

Move stringMatchesWildcardString from WebKit2 to WebCore
https://bugs.webkit.org/show_bug.cgi?id=169065

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj: Added StringUtilities.h and StringUtilities.mm
* PlatformMac.cmake: Added StringUtilities.mm
* platform/mac/StringUtilities.h: Added.
* platform/mac/StringUtilities.mm: Added.
(WebCore::wildcardRegexPatternString): Added.
(WebCore::stringMatchesWildcardString): Added.

Source/WebKit2:

* Platform/mac/StringUtilities.h: Moved stringMatchesWildcardString to WebCore.
* WebKit2.xcodeproj/project.pbxproj: Make StringUtilities.h a project header.
* Platform/mac/StringUtilities.mm:
(WebKit::wildcardRegexPatternString): Moved to WebCore.
(WebKit::stringMatchesWildcardString): Ditto.
* WebProcess/Plugins/WebPluginInfoProvider.cpp: Using stringMatchesWildcardString from WebCore.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Moved StringUtilities.mm
* TestWebKitAPI/Tests/WebCore/StringUtilities.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm.
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213318 => 213319)


--- trunk/Source/WebCore/ChangeLog	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebCore/ChangeLog	2017-03-02 23:56:03 UTC (rev 213319)
@@ -1,3 +1,17 @@
+2017-03-02  Aakash Jain  <aakash_j...@apple.com>
+
+        Move stringMatchesWildcardString from WebKit2 to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=169065
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebCore.xcodeproj/project.pbxproj: Added StringUtilities.h and StringUtilities.mm
+        * PlatformMac.cmake: Added StringUtilities.mm
+        * platform/mac/StringUtilities.h: Added.
+        * platform/mac/StringUtilities.mm: Added.
+        (WebCore::wildcardRegexPatternString): Added.
+        (WebCore::stringMatchesWildcardString): Added.
+
 2017-02-28  Matt Rajca  <mra...@apple.com>
 
         Media: send "did interfere with playback" events when the user pauses an autoplaying element

Modified: trunk/Source/WebCore/PlatformMac.cmake (213318 => 213319)


--- trunk/Source/WebCore/PlatformMac.cmake	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebCore/PlatformMac.cmake	2017-03-02 23:56:03 UTC (rev 213319)
@@ -486,6 +486,7 @@
     platform/mac/ScrollbarThemeMac.mm
     platform/mac/SerializedPlatformRepresentationMac.mm
     platform/mac/SoundMac.mm
+    platform/mac/StringUtilities.mm
     platform/mac/SuddenTermination.mm
     platform/mac/SystemSleepListenerMac.mm
     platform/mac/ThemeMac.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213318 => 213319)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-02 23:56:03 UTC (rev 213319)
@@ -6592,6 +6592,8 @@
 		E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */; };
 		EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF5121B1696496C0056BD25 /* JSTypeConversions.h */; };
+		ECA680C71E67724500731D20 /* StringUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = ECA680C61E67724500731D20 /* StringUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		ECA680C91E67730B00731D20 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = ECA680C81E67730B00731D20 /* StringUtilities.mm */; };
 		ECCDB8811E4B8C5900A1AEA6 /* WKContentObservationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ECCDB8801E4B8C5900A1AEA6 /* WKContentObservationInternal.h */; };
 		ECCDB8871E4BB63F00A1AEA6 /* WKGraphicsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ECCDB8861E4BB63F00A1AEA6 /* WKGraphicsInternal.h */; };
 		ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -14814,6 +14816,8 @@
 		EB081CD91696084400553730 /* TypeConversions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypeConversions.idl; sourceTree = "<group>"; };
 		EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypeConversions.cpp; sourceTree = "<group>"; };
 		EBF5121B1696496C0056BD25 /* JSTypeConversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypeConversions.h; sourceTree = "<group>"; };
+		ECA680C61E67724500731D20 /* StringUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtilities.h; sourceTree = "<group>"; };
+		ECA680C81E67730B00731D20 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; };
 		ECCDB8801E4B8C5900A1AEA6 /* WKContentObservationInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentObservationInternal.h; sourceTree = "<group>"; };
 		ECCDB8861E4BB63F00A1AEA6 /* WKGraphicsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGraphicsInternal.h; sourceTree = "<group>"; };
 		ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
@@ -18239,6 +18243,8 @@
 				077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */,
 				4B3043C80AE0371D00A82647 /* SoundMac.mm */,
 				84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
+				ECA680C61E67724500731D20 /* StringUtilities.h */,
+				ECA680C81E67730B00731D20 /* StringUtilities.mm */,
 				93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */,
 				CDA07FC018E0A22B004699FA /* SystemSleepListenerMac.h */,
 				CDA07FBF18E0A22B004699FA /* SystemSleepListenerMac.mm */,
@@ -27711,6 +27717,7 @@
 				371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
 				E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
 				51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
+				ECA680C71E67724500731D20 /* StringUtilities.h in Headers */,
 				FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */,
 				9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */,
 				0885067F11DA045B00182B98 /* PaintInfo.h in Headers */,
@@ -29580,6 +29587,7 @@
 				7A45032F18DB717200377B34 /* BufferedLineReader.cpp in Sources */,
 				F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */,
 				1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */,
+				ECA680C91E67730B00731D20 /* StringUtilities.mm in Sources */,
 				1A569CF90D7E2B82007C3983 /* c_instance.cpp in Sources */,
 				1A569CFB0D7E2B82007C3983 /* c_runtime.cpp in Sources */,
 				1A569CFD0D7E2B82007C3983 /* c_utility.cpp in Sources */,

Copied: trunk/Source/WebCore/platform/mac/StringUtilities.h (from rev 213317, trunk/Source/WebKit2/Platform/mac/StringUtilities.h) (0 => 213319)


--- trunk/Source/WebCore/platform/mac/StringUtilities.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/StringUtilities.h	2017-03-02 23:56:03 UTC (rev 213319)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 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. 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 INC. 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.
+ */
+
+#pragma once
+
+#import "PlatformExportMacros.h"
+#import <wtf/Forward.h>
+
+namespace WebCore {
+WEBCORE_EXPORT bool stringMatchesWildcardString(const String& stringToBeMatched, const String& wildcardString);
+}

Copied: trunk/Source/WebCore/platform/mac/StringUtilities.mm (from rev 213317, trunk/Source/WebKit2/Platform/mac/StringUtilities.h) (0 => 213319)


--- trunk/Source/WebCore/platform/mac/StringUtilities.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/StringUtilities.mm	2017-03-02 23:56:03 UTC (rev 213319)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 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. 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 INC. 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 "StringUtilities.h"
+
+#import <wtf/text/StringBuilder.h>
+#import <yarr/RegularExpression.h>
+
+namespace WebCore {
+    
+static String wildcardRegexPatternString(const String& string)
+{
+    String metaCharacters = ".|+?()[]{}^$";
+    UChar escapeCharacter = '\\';
+    UChar wildcardCharacter = '*';
+    
+    StringBuilder stringBuilder;
+    
+    stringBuilder.append('^');
+    for (unsigned i = 0; i < string.length(); i++) {
+        auto character = string[i];
+        if (metaCharacters.contains(character) || character == escapeCharacter)
+            stringBuilder.append(escapeCharacter);
+        else if (character == wildcardCharacter)
+            stringBuilder.append('.');
+        
+        stringBuilder.append(character);
+    }
+    stringBuilder.append('$');
+        
+    return stringBuilder.toString();
+}
+    
+bool stringMatchesWildcardString(const String& string, const String& wildcardString)
+{
+    return JSC::Yarr::RegularExpression(wildcardRegexPatternString(wildcardString), TextCaseInsensitive).match(string) != -1;
+}
+
+}

Modified: trunk/Source/WebKit2/ChangeLog (213318 => 213319)


--- trunk/Source/WebKit2/ChangeLog	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-02 23:56:03 UTC (rev 213319)
@@ -1,5 +1,19 @@
 2017-03-02  Aakash Jain  <aakash_j...@apple.com>
 
+        Move stringMatchesWildcardString from WebKit2 to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=169065
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Platform/mac/StringUtilities.h: Moved stringMatchesWildcardString to WebCore.
+        * WebKit2.xcodeproj/project.pbxproj: Make StringUtilities.h a project header.
+        * Platform/mac/StringUtilities.mm:
+        (WebKit::wildcardRegexPatternString): Moved to WebCore.
+        (WebKit::stringMatchesWildcardString): Ditto.
+        * WebProcess/Plugins/WebPluginInfoProvider.cpp: Using stringMatchesWildcardString from WebCore.
+
+2017-03-02  Aakash Jain  <aakash_j...@apple.com>
+
         IsSmartPtr<WKRetainPtr<T>>::value should not be exported
         https://bugs.webkit.org/show_bug.cgi?id=169047
 

Modified: trunk/Source/WebKit2/Platform/mac/StringUtilities.h (213318 => 213319)


--- trunk/Source/WebKit2/Platform/mac/StringUtilities.h	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebKit2/Platform/mac/StringUtilities.h	2017-03-02 23:56:03 UTC (rev 213319)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef StringUtilities_h
-#define StringUtilities_h
+#pragma once
 
 #import <WebKit/WKDeclarationSpecifiers.h>
 #import <wtf/Forward.h>
@@ -40,8 +39,4 @@
 
 #endif // defined(__OBJC__)
 
-WK_EXPORT bool stringMatchesWildcardString(const String& stringToBeMatched, const String& wildcardString);
-
 }
-
-#endif // StringUtilities_h

Modified: trunk/Source/WebKit2/Platform/mac/StringUtilities.mm (213318 => 213319)


--- trunk/Source/WebKit2/Platform/mac/StringUtilities.mm	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebKit2/Platform/mac/StringUtilities.mm	2017-03-02 23:56:03 UTC (rev 213319)
@@ -40,34 +40,6 @@
     return string.isEmpty() ? @"" : CFBridgingRelease(WKStringCopyCFString(0, toAPI(string.impl())));
 }
 
-static String wildcardRegexPatternString(const String& string)
-{
-    String metaCharacters = ".|+?()[]{}^$";
-    UChar escapeCharacter = '\\';
-    UChar wildcardCharacter = '*';
-
-    StringBuilder stringBuilder;
-
-    stringBuilder.append('^');
-    for (unsigned i = 0; i < string.length(); i++) {
-        auto character = string[i];
-        if (metaCharacters.contains(character) || character == escapeCharacter)
-            stringBuilder.append(escapeCharacter);
-        else if (character == wildcardCharacter)
-            stringBuilder.append('.');
-
-        stringBuilder.append(character);
-    }
-    stringBuilder.append('$');
-
-    return stringBuilder.toString();
-}
-
-bool stringMatchesWildcardString(const String& string, const String& wildcardString)
-{
-    return JSC::Yarr::RegularExpression(wildcardRegexPatternString(wildcardString), TextCaseInsensitive).match(string) != -1;
-}
-
 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
 
 SOFT_LINK_PRIVATE_FRAMEWORK(PhoneNumbers);

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (213318 => 213319)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-03-02 23:56:03 UTC (rev 213319)
@@ -592,7 +592,7 @@
 		293EBEAB1627D9C9005F89F1 /* WKDOMText.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EBEA91627D9C9005F89F1 /* WKDOMText.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		293EBEAC1627D9C9005F89F1 /* WKDOMText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */; };
 		29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 29501723162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		296BD85D15019BC30071F424 /* StringUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BD85B15019BC30071F424 /* StringUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		296BD85D15019BC30071F424 /* StringUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BD85B15019BC30071F424 /* StringUtilities.h */; };
 		296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 296BD85C15019BC30071F424 /* StringUtilities.mm */; };
 		2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */; };
 		2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */; };

Modified: trunk/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp (213318 => 213319)


--- trunk/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp	2017-03-02 23:56:03 UTC (rev 213319)
@@ -39,7 +39,9 @@
 #include <wtf/text/StringHash.h>
 
 #if PLATFORM(MAC)
-#include "StringUtilities.h"
+#include <WebCore/StringUtilities.h>
+
+using namespace WebCore;
 #endif
 
 namespace WebKit {

Modified: trunk/Tools/ChangeLog (213318 => 213319)


--- trunk/Tools/ChangeLog	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Tools/ChangeLog	2017-03-02 23:56:03 UTC (rev 213319)
@@ -1,3 +1,15 @@
+2017-03-02  Aakash Jain  <aakash_j...@apple.com>
+
+        Move stringMatchesWildcardString from WebKit2 to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=169065
+
+        Reviewed by Alexey Proskuryakov.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Moved StringUtilities.mm
+        * TestWebKitAPI/Tests/WebCore/StringUtilities.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm.
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm: Removed.
+
 2017-02-28  Matt Rajca  <mra...@apple.com>
 
         Media: send "did interfere with playback" events when the user pauses an autoplaying element

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213318 => 213319)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-03-02 23:56:03 UTC (rev 213319)
@@ -441,7 +441,6 @@
 		835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */; };
 		8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */; };
 		837A35F11D9A1E7D00663C57 /* DownloadRequestBlobURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */; };
-		83CF1C301C4F1B8B00688447 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */; };
 		8E4A85371E1D1AB200F53B0F /* GridPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */; };
 		930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
 		9329AA291DE3F81E003ABD07 /* TextBreakIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9329AA281DE3F81E003ABD07 /* TextBreakIterator.cpp */; };
@@ -560,6 +559,7 @@
 		D34E08761E4E42E1005FF14A /* WKWebViewGetContents.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */; };
 		E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
 		E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
+		ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = ECA680CD1E68CC0900731D20 /* StringUtilities.mm */; };
 		F415086D1DA040C50044BE9B /* play-audio-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F415086C1DA040C10044BE9B /* play-audio-on-click.html */; };
 		F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
 		F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
@@ -1156,7 +1156,6 @@
 		8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "link-with-download-attribute-with-slashes.html"; sourceTree = "<group>"; };
 		837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestBlobURL.html; sourceTree = "<group>"; };
 		83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserIdioms.cpp; sourceTree = "<group>"; };
-		83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; };
 		86BD19971A2DB05B006DCF0A /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = "<group>"; };
 		8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeWindowAfterCrash.cpp; sourceTree = "<group>"; };
 		8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReloadPageAfterCrash.cpp; sourceTree = "<group>"; };
@@ -1398,6 +1397,7 @@
 		E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
 		E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deque.cpp; sourceTree = "<group>"; };
 		E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
+		ECA680CD1E68CC0900731D20 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; };
 		F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		F415086C1DA040C10044BE9B /* play-audio-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "play-audio-on-click.html"; sourceTree = "<group>"; };
 		F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "large-input-field-focus-onload.html"; path = "Tests/WebKit2Cocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
@@ -1690,6 +1690,7 @@
 				41973B5C1AF22875006C7B36 /* SharedBuffer.cpp */,
 				A17991891E1CA24100A505ED /* SharedBufferTest.cpp */,
 				A179918A1E1CA24100A505ED /* SharedBufferTest.h */,
+				ECA680CD1E68CC0900731D20 /* StringUtilities.mm */,
 				CDC2C7141797089D00E627FB /* TimeRanges.cpp */,
 				7AD3FE8D1D75FB8D00B169A4 /* TransformationMatrix.cpp */,
 				440A1D3814A0103A008A66F2 /* URL.cpp */,
@@ -2305,7 +2306,6 @@
 				C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */,
 				C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */,
 				1AEF994817A09F5300998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp */,
-				83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -2819,7 +2819,6 @@
 				515BE1711D428E4B00DD7C68 /* StoreBlobThenDelete.mm in Sources */,
 				7CCE7ED01A411A7E00447C4C /* StringByEvaluatingJavaScriptFromString.mm in Sources */,
 				7CCE7ED11A411A7E00447C4C /* StringTruncator.mm in Sources */,
-				83CF1C301C4F1B8B00688447 /* StringUtilities.mm in Sources */,
 				7CCE7ED21A411A7E00447C4C /* SubresourceErrorCrash.mm in Sources */,
 				7CCE7EA81A411A1900447C4C /* SyntheticBackingScaleFactorWindow.m in Sources */,
 				7CCE7F161A411AE600447C4C /* TerminateTwice.cpp in Sources */,
@@ -2853,6 +2852,7 @@
 				2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */,
 				7C83E04C1D0A641800FEBCF3 /* WebCoreNSURLSession.mm in Sources */,
 				CDCFA7AA1E45183200C2433D /* SampleMap.cpp in Sources */,
+				ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */,
 				7CCE7F1A1A411AE600447C4C /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */,
 				7CCE7EAB1A411A2400447C4C /* WebKitAgnosticTest.mm in Sources */,
 				5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/StringUtilities.mm (0 => 213319)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/StringUtilities.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/StringUtilities.mm	2017-03-02 23:56:03 UTC (rev 213319)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016 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. 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 INC. 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 <WebCore/StringUtilities.h>
+#import <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace TestWebKitAPI {
+
+TEST(WebCore, WildcardStringMatching)
+{
+    String wildcardString = "a*b";
+    EXPECT_TRUE(stringMatchesWildcardString("aaaabb", "a*b"));
+    EXPECT_TRUE(stringMatchesWildcardString("ab", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("ba", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("a", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("b", wildcardString));
+
+    wildcardString = "aabb";
+    EXPECT_TRUE(stringMatchesWildcardString("aabb", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("a*b", wildcardString));
+
+    wildcardString = "*apple*";
+    EXPECT_TRUE(stringMatchesWildcardString("freshapple", wildcardString));
+    EXPECT_TRUE(stringMatchesWildcardString("applefresh", wildcardString));
+    EXPECT_TRUE(stringMatchesWildcardString("freshapplefresh", wildcardString));
+
+    wildcardString = "a*b*c";
+    EXPECT_TRUE(stringMatchesWildcardString("aabbcc", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("bca", wildcardString));
+
+    wildcardString = "*.example*.com/*";
+    EXPECT_TRUE(stringMatchesWildcardString("food.examplehello.com/", wildcardString));
+    EXPECT_TRUE(stringMatchesWildcardString("food.example.com/bar.html", wildcardString));
+    EXPECT_TRUE(stringMatchesWildcardString("foo.bar.example.com/hello?query#fragment.html", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("food.example.com", wildcardString));
+
+    wildcardString = "a*b.b*c";
+    EXPECT_TRUE(stringMatchesWildcardString("aabb.bbcc", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("aabbcbbcc", wildcardString));
+
+    wildcardString = "a+b";
+    EXPECT_TRUE(stringMatchesWildcardString("a+b", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("ab", wildcardString));
+
+    wildcardString = "(a*)b aa";
+    EXPECT_TRUE(stringMatchesWildcardString("(aaa)b aa", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("aab aa", wildcardString));
+
+    wildcardString = "a|c";
+    EXPECT_TRUE(stringMatchesWildcardString("a|c", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("abc", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("a", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("c", wildcardString));
+
+    wildcardString = "(a+|b)*";
+    EXPECT_TRUE(stringMatchesWildcardString("(a+|b)acca", "(a+|b)*"));
+    EXPECT_FALSE(stringMatchesWildcardString("ab", "(a+|b)*"));
+
+    wildcardString = "a[-]?c";
+    EXPECT_TRUE(stringMatchesWildcardString("a[-]?c", wildcardString));
+    EXPECT_FALSE(stringMatchesWildcardString("ac", wildcardString));
+
+    EXPECT_FALSE(stringMatchesWildcardString("hello", "^hello$"));
+    EXPECT_TRUE(stringMatchesWildcardString(" ", " "));
+    EXPECT_TRUE(stringMatchesWildcardString("^$", "^$"));
+    EXPECT_FALSE(stringMatchesWildcardString("a", "a{1}"));
+
+    // stringMatchesWildcardString should only match the entire string.
+    EXPECT_FALSE(stringMatchesWildcardString("aabbaabb", "aabb"));
+    EXPECT_FALSE(stringMatchesWildcardString("aabb\naabb", "aabb"));
+    EXPECT_FALSE(stringMatchesWildcardString("bab", "a*"));
+    EXPECT_FALSE(stringMatchesWildcardString("bab", "*a"));
+    EXPECT_FALSE(stringMatchesWildcardString("bab", "a*b"));
+    EXPECT_FALSE(stringMatchesWildcardString("abcd", "b*c"));
+}
+
+}

Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm (213318 => 213319)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm	2017-03-02 23:55:54 UTC (rev 213318)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/StringUtilities.mm	2017-03-02 23:56:03 UTC (rev 213319)
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2016 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. 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 INC. 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 <WebKit/StringUtilities.h>
-#import <wtf/text/WTFString.h>
-
-namespace TestWebKitAPI {
-
-TEST(WebKit2, WildcardStringMatching)
-{
-    String wildcardString = "a*b";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("aaaabb", "a*b"));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("ab", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("ba", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("a", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("b", wildcardString));
-
-    wildcardString = "aabb";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("aabb", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("a*b", wildcardString));
-
-    wildcardString = "*apple*";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("freshapple", wildcardString));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("applefresh", wildcardString));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("freshapplefresh", wildcardString));
-
-    wildcardString = "a*b*c";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("aabbcc", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("bca", wildcardString));
-
-    wildcardString = "*.example*.com/*";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("food.examplehello.com/", wildcardString));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("food.example.com/bar.html", wildcardString));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("foo.bar.example.com/hello?query#fragment.html", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("food.example.com", wildcardString));
-
-    wildcardString = "a*b.b*c";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("aabb.bbcc", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("aabbcbbcc", wildcardString));
-
-    wildcardString = "a+b";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("a+b", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("ab", wildcardString));
-
-    wildcardString = "(a*)b aa";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("(aaa)b aa", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("aab aa", wildcardString));
-
-    wildcardString = "a|c";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("a|c", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("abc", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("a", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("c", wildcardString));
-
-    wildcardString = "(a+|b)*";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("(a+|b)acca", "(a+|b)*"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("ab", "(a+|b)*"));
-
-    wildcardString = "a[-]?c";
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("a[-]?c", wildcardString));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("ac", wildcardString));
-
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("hello", "^hello$"));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString(" ", " "));
-    EXPECT_TRUE(WebKit::stringMatchesWildcardString("^$", "^$"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("a", "a{1}"));
-
-    // stringMatchesWildcardString should only match the entire string.
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("aabbaabb", "aabb"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("aabb\naabb", "aabb"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("bab", "a*"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("bab", "*a"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("bab", "a*b"));
-    EXPECT_FALSE(WebKit::stringMatchesWildcardString("abcd", "b*c"));
-}
-
-}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to