Implement URL and trivially missing URLUtils members

Fixes #6322.
This commit is contained in:
Anthony Ramine 2015-06-13 21:49:49 +02:00
parent e7808c526c
commit a8e4558e82
26 changed files with 310 additions and 956 deletions

View file

@ -12,6 +12,7 @@ use dom::urlhelper::UrlHelper;
use dom::workerglobalscope::WorkerGlobalScope;
use url::Url;
use util::str::DOMString;
// https://html.spec.whatwg.org/multipage/#worker-locations
#[dom_struct]
@ -36,16 +37,49 @@ impl WorkerLocation {
}
impl<'a> WorkerLocationMethods for &'a WorkerLocation {
// https://url.spec.whatwg.org/#dom-urlutils-hash
fn Hash(self) -> USVString {
UrlHelper::Hash(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-host
fn Host(self) -> USVString {
UrlHelper::Host(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-hostname
fn Hostname(self) -> USVString {
UrlHelper::Hostname(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-href
fn Href(self) -> USVString {
UrlHelper::Href(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-pathname
fn Pathname(self) -> USVString {
UrlHelper::Pathname(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-port
fn Port(self) -> USVString {
UrlHelper::Port(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-protocol
fn Protocol(self) -> USVString {
UrlHelper::Protocol(&self.url)
}
// https://url.spec.whatwg.org/#dom-urlutils-search
fn Search(self) -> USVString {
UrlHelper::Search(&self.url)
}
fn Hash(self) -> USVString {
UrlHelper::Hash(&self.url)
// https://url.spec.whatwg.org/#URLUtils-stringification-behavior
fn Stringifier(self) -> DOMString {
self.Href().0
}
}