Diff
Modified: trunk/Source/WebCore/ChangeLog (228117 => 228118)
--- trunk/Source/WebCore/ChangeLog 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/ChangeLog 2018-02-05 21:36:18 UTC (rev 228118)
@@ -1,5 +1,18 @@
2018-02-05 Matt Lewis <jlew...@apple.com>
+ Unreviewed, rolling out r228086.
+
+ This introduced a failure with API test
+ URLTest.HostIsIPAddress.
+
+ Reverted changeset:
+
+ "Add a way to check if a host is an IP address"
+ https://bugs.webkit.org/show_bug.cgi?id=182427
+ https://trac.webkit.org/changeset/228086
+
+2018-02-05 Matt Lewis <jlew...@apple.com>
+
Unreviewed, rolling out r228103.
This caused multiple tests to crash.
Modified: trunk/Source/WebCore/page/OriginAccessEntry.cpp (228117 => 228118)
--- trunk/Source/WebCore/page/OriginAccessEntry.cpp 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/page/OriginAccessEntry.cpp 2018-02-05 21:36:18 UTC (rev 228118)
@@ -40,9 +40,11 @@
, m_host(host.convertToASCIILowercase())
, m_subdomainSettings(subdomainSetting)
, m_ipAddressSettings(ipAddressSetting)
- , m_hostIsIPAddress(URL::hostIsIPAddress(m_host))
{
ASSERT(subdomainSetting == AllowSubdomains || subdomainSetting == DisallowSubdomains);
+
+ // Assume that any host that ends with a digit is trying to be an IP address.
+ m_hostIsIPAddress = !m_host.isEmpty() && isASCIIDigit(m_host[m_host.length() - 1]);
}
bool OriginAccessEntry::matchesOrigin(const SecurityOrigin& origin) const
@@ -67,7 +69,7 @@
// IP addresses are not domains: https://url.spec.whatwg.org/#concept-domain
// Don't try to do subdomain matching on IP addresses.
- if (m_ipAddressSettings == TreatIPAddressAsIPAddress && (m_hostIsIPAddress || URL::hostIsIPAddress(origin.host())))
+ if (m_hostIsIPAddress && m_ipAddressSettings == TreatIPAddressAsIPAddress)
return false;
// Match subdomains.
Modified: trunk/Source/WebCore/platform/URL.cpp (228117 => 228118)
--- trunk/Source/WebCore/platform/URL.cpp 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/URL.cpp 2018-02-05 21:36:18 UTC (rev 228118)
@@ -1035,12 +1035,4 @@
return ts;
}
-#if !PLATFORM(COCOA) && !USE(SOUP)
-bool URL::hostIsIPAddress(const String& host)
-{
- // Assume that any host that ends with a digit is trying to be an IP address.
- return !host.isEmpty() && isASCIIDigit(host[host.length() - 1]);
-}
-#endif
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/URL.h (228117 => 228118)
--- trunk/Source/WebCore/platform/URL.h 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/URL.h 2018-02-05 21:36:18 UTC (rev 228118)
@@ -175,8 +175,6 @@
unsigned hostStart() const;
unsigned hostEnd() const;
- WEBCORE_EXPORT static bool hostIsIPAddress(const String&);
-
unsigned pathStart() const;
unsigned pathEnd() const;
unsigned pathAfterLastSlash() const;
Modified: trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm (228117 => 228118)
--- trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm 2018-02-05 21:36:18 UTC (rev 228118)
@@ -28,9 +28,13 @@
#if ENABLE(PUBLIC_SUFFIX_LIST)
-#import "URL.h"
+#import "WebCoreNSURLExtras.h"
#import <pal/spi/cf/CFNetworkSPI.h>
+@interface NSString (WebCoreNSURLExtras)
+- (BOOL)_web_looksLikeIPAddress;
+@end
+
namespace WebCore {
bool isPublicSuffix(const String& domain)
@@ -41,7 +45,7 @@
String topPrivatelyControlledDomain(const String& domain)
{
- if (URL::hostIsIPAddress(domain))
+ if ([domain _web_looksLikeIPAddress])
return domain;
if (!domain.isAllASCII())
Modified: trunk/Source/WebCore/platform/mac/URLMac.mm (228117 => 228118)
--- trunk/Source/WebCore/platform/mac/URLMac.mm 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/mac/URLMac.mm 2018-02-05 21:36:18 UTC (rev 228118)
@@ -28,14 +28,9 @@
#import "CFURLExtras.h"
#import "URLParser.h"
-#import "WebCoreNSURLExtras.h"
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/text/CString.h>
-@interface NSString (WebCoreNSURLExtras)
-- (BOOL)_web_looksLikeIPAddress;
-@end
-
namespace WebCore {
URL::URL(NSURL *url)
@@ -79,9 +74,4 @@
return createCFURLFromBuffer(buffer.data(), buffer.size());
}
-bool URL::hostIsIPAddress(const String& host)
-{
- return [host _web_looksLikeIPAddress];
}
-
-}
Modified: trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp (228117 => 228118)
--- trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp 2018-02-05 21:36:18 UTC (rev 228118)
@@ -53,7 +53,8 @@
bool isIPAddress(const String& hostname)
{
- return URL::hostIsIPAddress(hostname);
+ // Assuming that hosts ending in a digit are IP Addresses
+ return !hostname.isEmpty() && isASCIIDigit(hostname[hostname.length() - 1]);
}
bool domainMatch(const String& cookieDomain, const String& host)
Modified: trunk/Source/WebCore/platform/soup/URLSoup.cpp (228117 => 228118)
--- trunk/Source/WebCore/platform/soup/URLSoup.cpp 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Source/WebCore/platform/soup/URLSoup.cpp 2018-02-05 21:36:18 UTC (rev 228118)
@@ -66,11 +66,6 @@
return GUniquePtr<SoupURI>(soup_uri_new(string().utf8().data()));
}
-bool URL::hostIsIPAddress(const String& host)
-{
- return !host.isEmpty() && g_hostname_is_ip_address(host.utf8().data());
-}
-
} // namespace WebCore
#endif
Modified: trunk/Tools/ChangeLog (228117 => 228118)
--- trunk/Tools/ChangeLog 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Tools/ChangeLog 2018-02-05 21:36:18 UTC (rev 228118)
@@ -1,3 +1,16 @@
+2018-02-05 Matt Lewis <jlew...@apple.com>
+
+ Unreviewed, rolling out r228086.
+
+ This introduced a failure with API test
+ URLTest.HostIsIPAddress.
+
+ Reverted changeset:
+
+ "Add a way to check if a host is an IP address"
+ https://bugs.webkit.org/show_bug.cgi?id=182427
+ https://trac.webkit.org/changeset/228086
+
2018-02-05 John Wilander <wilan...@apple.com>
Storage Access API: Add testRunner.getAllStorageAccessEntries() to make testing easier and more explicit
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp (228117 => 228118)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp 2018-02-05 21:17:40 UTC (rev 228117)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp 2018-02-05 21:36:18 UTC (rev 228118)
@@ -231,34 +231,4 @@
EXPECT_TRUE(protocolIsInHTTPFamily("https://!@#$%^&*()"));
}
-TEST_F(URLTest, HostIsIPAddress)
-{
- EXPECT_FALSE(URL::hostIsIPAddress({ }));
- EXPECT_FALSE(URL::hostIsIPAddress(""));
- EXPECT_FALSE(URL::hostIsIPAddress("localhost"));
- EXPECT_FALSE(URL::hostIsIPAddress("127.localhost"));
- EXPECT_FALSE(URL::hostIsIPAddress("localhost.127"));
- EXPECT_FALSE(URL::hostIsIPAddress("127.0.0"));
- EXPECT_FALSE(URL::hostIsIPAddress("127.0 .0.1"));
- EXPECT_FALSE(URL::hostIsIPAddress(" 127.0.0.1"));
- EXPECT_FALSE(URL::hostIsIPAddress("127..0.0.1"));
- EXPECT_FALSE(URL::hostIsIPAddress("127.0.0."));
- EXPECT_FALSE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98"));
- EXPECT_FALSE(URL::hostIsIPAddress("012x:4567:89AB:cdef:3210:7654:ba98:FeDc"));
- EXPECT_FALSE(URL::hostIsIPAddress("00123:4567:89AB:cdef:3210:7654:ba98:FeDc"));
- EXPECT_FALSE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:123.45.67.89"));
- EXPECT_FALSE(URL::hostIsIPAddress(":::"));
-
- EXPECT_TRUE(URL::hostIsIPAddress("127.0.0.1"));
- EXPECT_TRUE(URL::hostIsIPAddress("123.45.67.89"));
- EXPECT_TRUE(URL::hostIsIPAddress("0.0.0.0"));
- EXPECT_TRUE(URL::hostIsIPAddress("::1"));
- EXPECT_TRUE(URL::hostIsIPAddress("::"));
- EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98:FeDc"));
- EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98::"));
- EXPECT_TRUE(URL::hostIsIPAddress("::4567:89AB:cdef:3210:7654:ba98:FeDc"));
- EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:123.45.67.89"));
- EXPECT_TRUE(URL::hostIsIPAddress("::123.45.67.89"));
-}
-
} // namespace TestWebKitAPI