diff options
-rw-r--r-- | components/constellation/constellation.rs | 10 | ||||
-rw-r--r-- | components/net_traits/pub_domains.rs | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 8201b23382b..12a641c3c08 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -86,7 +86,7 @@ use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection}; use net_traits::{self, IpcSend, ResourceThreads}; use net_traits::image_cache_thread::ImageCacheThread; -use net_traits::pub_domains::reg_suffix; +use net_traits::pub_domains::reg_host; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use offscreen_gl_context::{GLContextAttributes, GLLimits}; use pipeline::{InitialPipelineState, Pipeline}; @@ -644,14 +644,6 @@ fn log_entry(record: &LogRecord) -> Option<LogEntry> { /// The number of warnings to include in each crash report. const WARNINGS_BUFFER_SIZE: usize = 32; -/// The registered domain name (aka eTLD+1) for a URL. -/// Returns None if the URL has no host name. -/// Returns the registered suffix for the host name if it is a domain. -/// Leaves the host name alone if it is an IP address. -fn reg_host<'a>(url: &'a ServoUrl) -> Option<&'a str> { - url.domain().map(reg_suffix).or(url.host_str()) -} - impl<Message, LTF, STF> Constellation<Message, LTF, STF> where LTF: LayoutThreadFactory<Message=Message>, STF: ScriptThreadFactory<Message=Message> diff --git a/components/net_traits/pub_domains.rs b/components/net_traits/pub_domains.rs index 8e8864ee6aa..664c39fb09b 100644 --- a/components/net_traits/pub_domains.rs +++ b/components/net_traits/pub_domains.rs @@ -15,6 +15,7 @@ //! those cases are not present. use servo_config::resource_files::read_resource_file; +use servo_url::ServoUrl; use std::collections::HashSet; use std::iter::FromIterator; use std::str::from_utf8; @@ -138,3 +139,11 @@ pub fn is_pub_domain(domain: &str) -> bool { pub fn is_reg_domain(domain: &str) -> bool { PUB_DOMAINS.is_registrable_suffix(domain) } + +/// The registered domain name (aka eTLD+1) for a URL. +/// Returns None if the URL has no host name. +/// Returns the registered suffix for the host name if it is a domain. +/// Leaves the host name alone if it is an IP address. +pub fn reg_host<'a>(url: &'a ServoUrl) -> Option<&'a str> { + url.domain().map(reg_suffix).or(url.host_str()) +} |