Title: [237584] trunk
Revision
237584
Author
[email protected]
Date
2018-10-30 01:26:57 -0700 (Tue, 30 Oct 2018)

Log Message

[GTK][WPE] Fixes to the PublicSuffix implementation
https://bugs.webkit.org/show_bug.cgi?id=191031

Reviewed by Michael Catanzaro.

Source/WebCore:

Covered by existing tests.

Downcase hostnames before passing it on to the underlying
libsoup API. Special case localhost and fix a mixed-up
libsoup GError checks. This fixes most of the failures.

* platform/soup/PublicSuffixSoup.cpp:
(WebCore::isPublicSuffix):
(WebCore::topPrivatelyControlledDomain):

Tools:

* TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
(TestWebKitAPI::TEST_F): Remove a test for a domain
that is not registrable and shouldn't be tested there.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237583 => 237584)


--- trunk/Source/WebCore/ChangeLog	2018-10-30 05:52:40 UTC (rev 237583)
+++ trunk/Source/WebCore/ChangeLog	2018-10-30 08:26:57 UTC (rev 237584)
@@ -1,3 +1,20 @@
+2018-10-30  Claudio Saavedra  <[email protected]>
+
+        [GTK][WPE] Fixes to the PublicSuffix implementation
+        https://bugs.webkit.org/show_bug.cgi?id=191031
+
+        Reviewed by Michael Catanzaro.
+
+        Covered by existing tests.
+
+        Downcase hostnames before passing it on to the underlying
+        libsoup API. Special case localhost and fix a mixed-up
+        libsoup GError checks. This fixes most of the failures.
+
+        * platform/soup/PublicSuffixSoup.cpp:
+        (WebCore::isPublicSuffix):
+        (WebCore::topPrivatelyControlledDomain):
+
 2018-10-29  Zalan Bujtas  <[email protected]>
 
         Missing from r237549

Modified: trunk/Source/WebCore/platform/soup/PublicSuffixSoup.cpp (237583 => 237584)


--- trunk/Source/WebCore/platform/soup/PublicSuffixSoup.cpp	2018-10-30 05:52:40 UTC (rev 237583)
+++ trunk/Source/WebCore/platform/soup/PublicSuffixSoup.cpp	2018-10-30 08:26:57 UTC (rev 237584)
@@ -38,7 +38,7 @@
     if (domain.isEmpty())
         return false;
 
-    return soup_tld_domain_is_public_suffix(domain.utf8().data());
+    return soup_tld_domain_is_public_suffix(domain.convertToASCIILowercase().utf8().data());
 }
 
 String topPrivatelyControlledDomain(const String& domain)
@@ -46,15 +46,21 @@
     if (domain.isEmpty())
         return String();
 
+    String lowercaseDomain = domain.convertToASCIILowercase();
+
+    if (lowercaseDomain == "localhost")
+        return lowercaseDomain;
+
     GUniqueOutPtr<GError> error;
-    CString domainUTF8 = domain.utf8();
+    CString domainUTF8 = lowercaseDomain.utf8();
+
     if (const char* baseDomain = soup_tld_get_base_domain(domainUTF8.data(), &error.outPtr()))
         return String::fromUTF8(baseDomain);
 
-    if (g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_NO_BASE_DOMAIN) || g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS))
+    if (g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_INVALID_HOSTNAME) || g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS))
         return String();
 
-    if (g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_IS_IP_ADDRESS) || g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_INVALID_HOSTNAME))
+    if (g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_IS_IP_ADDRESS) || g_error_matches(error.get(), SOUP_TLD_ERROR, SOUP_TLD_ERROR_NO_BASE_DOMAIN))
         return domain;
 
     ASSERT_NOT_REACHED();

Modified: trunk/Tools/ChangeLog (237583 => 237584)


--- trunk/Tools/ChangeLog	2018-10-30 05:52:40 UTC (rev 237583)
+++ trunk/Tools/ChangeLog	2018-10-30 08:26:57 UTC (rev 237584)
@@ -1,3 +1,14 @@
+2018-10-30  Claudio Saavedra  <[email protected]>
+
+        [GTK][WPE] Fixes to the PublicSuffix implementation
+        https://bugs.webkit.org/show_bug.cgi?id=191031
+
+        Reviewed by Michael Catanzaro.
+
+        * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+        (TestWebKitAPI::TEST_F): Remove a test for a domain
+        that is not registrable and shouldn't be tested there.
+
 2018-10-29  Tim Horton  <[email protected]>
 
         Modernize WebKit nibs and lprojs for localization's sake

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp (237583 => 237584)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp	2018-10-30 05:52:40 UTC (rev 237583)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp	2018-10-30 08:26:57 UTC (rev 237584)
@@ -153,7 +153,6 @@
 
 TEST_F(PublicSuffix, TopPrivatelyControlledDomain)
 {
-    EXPECT_EQ(utf16String(u"\u6803\u6728.jp"), topPrivatelyControlledDomain(utf16String(u"\u6803\u6728.jp")));
     EXPECT_EQ(String(utf16String(u"example.\u6803\u6728.jp")), topPrivatelyControlledDomain(utf16String(u"example.\u6803\u6728.jp")));
     EXPECT_EQ(String(), topPrivatelyControlledDomain(String()));
     EXPECT_EQ(String(), topPrivatelyControlledDomain(""));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to