mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Implement setter for document.domain
This commit is contained in:
parent
1f61a549a3
commit
5348b63e38
68 changed files with 217 additions and 736 deletions
|
@ -146,11 +146,10 @@ pub fn is_reg_domain(domain: &str) -> bool {
|
|||
/// 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<Host> {
|
||||
pub fn reg_host(url: &ServoUrl) -> Option<Host> {
|
||||
match url.origin() {
|
||||
ImmutableOrigin::Tuple(_, Host::Domain(domain), _) => Some(Host::Domain(String::from(reg_suffix(&*domain)))),
|
||||
ImmutableOrigin::Tuple(_, Host::Ipv4(address), _) => Some(Host::Ipv4(address)),
|
||||
ImmutableOrigin::Tuple(_, Host::Ipv6(address), _) => Some(Host::Ipv6(address)),
|
||||
ImmutableOrigin::Tuple(_, ip, _) => Some(ip),
|
||||
ImmutableOrigin::Opaque(_) => None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue