aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/urlhelper.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-14 01:56:15 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-10-19 21:05:07 +0200
commit57c423a93142e072a992aa33c3ecca9446c477b0 (patch)
treeeefe41008e917df08620b98050c035cb776ad538 /components/script/dom/urlhelper.rs
parente0c8a88410277843714a20d5fced73a392fad861 (diff)
downloadservo-57c423a93142e072a992aa33c3ecca9446c477b0.tar.gz
servo-57c423a93142e072a992aa33c3ecca9446c477b0.zip
Update URL-related interfaces and their tests up to spec
The URL spec recently changed and the variour "mixins" interfaces are gone, this commit updates our code and WPT accordingly. The new expected failures related to HTMLAnchorElement and HTMLAreaElement's attributes are due to their moving to the HTMLHyperLinkElementUtils interface, which is not anymore in a separate <script class=untested> element.
Diffstat (limited to 'components/script/dom/urlhelper.rs')
-rw-r--r--components/script/dom/urlhelper.rs19
1 files changed, 0 insertions, 19 deletions
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index 8d6916c0551..d9e26e84263 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -12,7 +12,6 @@ use url::{SchemeData, Url, UrlParser};
pub struct UrlHelper;
impl UrlHelper {
- // https://url.spec.whatwg.org/#dom-urlutils-hash
pub fn Hash(url: &Url) -> USVString {
USVString(match url.fragment {
None => "".to_owned(),
@@ -21,13 +20,11 @@ impl UrlHelper {
})
}
- // https://url.spec.whatwg.org/#dom-urlutils-hash
pub fn SetHash(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_fragment(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-host
pub fn Host(url: &Url) -> USVString {
USVString(match url.scheme_data {
SchemeData::NonRelative(..) => "".to_owned(),
@@ -41,40 +38,33 @@ impl UrlHelper {
})
}
- // https://url.spec.whatwg.org/#dom-urlutils-host
pub fn SetHost(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_host(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-hostname
pub fn Hostname(url: &Url) -> USVString {
USVString(url.serialize_host().unwrap_or_else(|| "".to_owned()))
}
- // https://url.spec.whatwg.org/#dom-urlutils-hostname
pub fn SetHostname(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_host_and_port(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-href
pub fn Href(url: &Url) -> USVString {
USVString(url.serialize())
}
- // https://url.spec.whatwg.org/#dom-urlutils-password
pub fn Password(url: &Url) -> USVString {
USVString(url.password().unwrap_or("").to_owned())
}
- // https://url.spec.whatwg.org/#dom-urlutils-password
pub fn SetPassword(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_password(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-pathname
pub fn Pathname(url: &Url) -> USVString {
USVString(match url.scheme_data {
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
@@ -82,13 +72,11 @@ impl UrlHelper {
})
}
- // https://url.spec.whatwg.org/#dom-urlutils-pathname
pub fn SetPathname(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_path(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-port
pub fn Port(url: &Url) -> USVString {
USVString(match url.port() {
None => "".to_owned(),
@@ -96,18 +84,15 @@ impl UrlHelper {
})
}
- // https://url.spec.whatwg.org/#dom-urlutils-port
pub fn SetPort(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_port(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-protocol
pub fn Protocol(url: &Url) -> USVString {
USVString(format!("{}:", url.scheme.clone()))
}
- // https://url.spec.whatwg.org/#dom-urlutils-protocol
pub fn SetProtocol(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_scheme(&value.0);
@@ -127,7 +112,6 @@ impl UrlHelper {
true
}
- // https://url.spec.whatwg.org/#dom-urlutils-search
pub fn Search(url: &Url) -> USVString {
USVString(match url.query {
None => "".to_owned(),
@@ -136,18 +120,15 @@ impl UrlHelper {
})
}
- // https://url.spec.whatwg.org/#dom-urlutils-search
pub fn SetSearch(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_query(&value.0);
}
- // https://url.spec.whatwg.org/#dom-urlutils-username
pub fn Username(url: &Url) -> USVString {
USVString(url.username().unwrap_or("").to_owned())
}
- // https://url.spec.whatwg.org/#dom-urlutils-username
pub fn SetUsername(url: &mut Url, value: USVString) {
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
let _ = wrapper.set_username(&value.0);