Index: content/renderer/webpublicsuffixlist_impl.cc |
diff --git a/content/renderer/webpublicsuffixlist_impl.cc b/content/renderer/webpublicsuffixlist_impl.cc |
index e1e00c22be28c7c42184e38d29999cb81d9f7308..97faedc8659e2702521689caaebe308a6a48a847 100644 |
--- a/content/renderer/webpublicsuffixlist_impl.cc |
+++ b/content/renderer/webpublicsuffixlist_impl.cc |
@@ -5,6 +5,8 @@ |
#include "content/renderer/webpublicsuffixlist_impl.h" |
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
+#include "net/base/url_util.h" |
+#include "url/url_canon.h" |
namespace content { |
@@ -13,10 +15,16 @@ WebPublicSuffixListImpl::~WebPublicSuffixListImpl() { |
size_t WebPublicSuffixListImpl::getPublicSuffixLength( |
const blink::WebString& host) { |
- size_t result = net::registry_controlled_domains::GetRegistryLength( |
- host.utf8(), |
- net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, |
- net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
+#ifndef NDEBUG |
+ // Blink should only be calling us with canonical URLs. |
+ url::CanonHostInfo host_info; |
+ DCHECK_EQ(net::CanonicalizeHost(host.utf8(), &host_info), host.utf8()); |
+#endif |
+ size_t result = |
+ net::registry_controlled_domains::GetRegistryLengthForCanonicalHost( |
+ host.utf8(), |
+ net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, |
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
return result ? result : host.length(); |
} |