diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-14 01:56:15 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-19 21:05:07 +0200 |
commit | 57c423a93142e072a992aa33c3ecca9446c477b0 (patch) | |
tree | eefe41008e917df08620b98050c035cb776ad538 /components/script/dom/location.rs | |
parent | e0c8a88410277843714a20d5fced73a392fad861 (diff) | |
download | servo-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/location.rs')
-rw-r--r-- | components/script/dom/location.rs | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 230cf2748da..a9e788a7b04 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -4,7 +4,6 @@ use dom::bindings::codegen::Bindings::LocationBinding; use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; -use dom::bindings::error::ErrorResult; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; use dom::bindings::str::USVString; @@ -48,11 +47,11 @@ impl Location { impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign - fn Assign(&self, url: DOMString) { + fn Assign(&self, url: USVString) { // TODO: per spec, we should use the _API base URL_ specified by the // _entry settings object_. let base_url = self.window.get_url(); - if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url) { + if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url.0) { self.window.load_url(url); } } @@ -62,111 +61,90 @@ impl LocationMethods for Location { self.window.load_url(self.get_url()); } - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://html.spec.whatwg.org/multipage/#dom-location-hash fn Hash(&self) -> USVString { UrlHelper::Hash(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://html.spec.whatwg.org/multipage/#dom-location-hash fn SetHash(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHash); } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://html.spec.whatwg.org/multipage/#dom-location-host fn Host(&self) -> USVString { UrlHelper::Host(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://html.spec.whatwg.org/multipage/#dom-location-host fn SetHost(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHost); } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn Hostname(&self) -> USVString { UrlHelper::Hostname(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn SetHostname(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHostname); } - // https://url.spec.whatwg.org/#dom-urlutils-href + // https://html.spec.whatwg.org/multipage/#dom-location-href fn Href(&self) -> USVString { UrlHelper::Href(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-href - fn SetHref(&self, value: USVString) -> ErrorResult { + // https://html.spec.whatwg.org/multipage/#dom-location-href + fn SetHref(&self, value: USVString) { if let Ok(url) = UrlParser::new().base_url(&self.window.get_url()).parse(&value.0) { self.window.load_url(url); - }; - Ok(()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-password - fn Password(&self) -> USVString { - UrlHelper::Password(&self.get_url()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-password - fn SetPassword(&self, value: USVString) { - self.set_url_component(value, UrlHelper::SetPassword); + } } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn Pathname(&self) -> USVString { UrlHelper::Pathname(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn SetPathname(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetPathname); } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://html.spec.whatwg.org/multipage/#dom-location-port fn Port(&self) -> USVString { UrlHelper::Port(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://html.spec.whatwg.org/multipage/#dom-location-port fn SetPort(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetPort); } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn Protocol(&self) -> USVString { UrlHelper::Protocol(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn SetProtocol(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetProtocol); } - // https://url.spec.whatwg.org/#URLUtils-stringification-behavior + // https://html.spec.whatwg.org/multipage/#dom-location-href fn Stringifier(&self) -> DOMString { self.Href().0 } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://html.spec.whatwg.org/multipage/#dom-location-search fn Search(&self) -> USVString { UrlHelper::Search(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://html.spec.whatwg.org/multipage/#dom-location-search fn SetSearch(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetSearch); } - - // https://url.spec.whatwg.org/#dom-urlutils-username - fn Username(&self) -> USVString { - UrlHelper::Username(&self.get_url()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-username - fn SetUsername(&self, value: USVString) { - self.set_url_component(value, UrlHelper::SetUsername); - } } |