diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-06-13 21:49:49 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-06-20 15:17:55 +0200 |
commit | a8e4558e8245aadbf573b244f8e8210b251519cf (patch) | |
tree | ba5aa221748e8ea2416de1ff834853b5fa6b5bd8 /components/script/dom/workerlocation.rs | |
parent | e7808c526c348fea5e3b48af70b7f1a066652097 (diff) | |
download | servo-a8e4558e8245aadbf573b244f8e8210b251519cf.tar.gz servo-a8e4558e8245aadbf573b244f8e8210b251519cf.zip |
Implement URL and trivially missing URLUtils members
Fixes #6322.
Diffstat (limited to 'components/script/dom/workerlocation.rs')
-rw-r--r-- | components/script/dom/workerlocation.rs | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index ec56ad79015..b125b778822 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -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 } } |