diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-06-18 13:21:32 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-06-18 13:21:49 +0200 |
commit | 7af5a7fd5409ab8db0274eb829136e5953e718ed (patch) | |
tree | ee7103d6651e45943609118f93cc8789ebbb4d86 /components/script/dom/location.rs | |
parent | a5bb55790fe34de6e6dc561314d2a9491972585e (diff) | |
download | servo-7af5a7fd5409ab8db0274eb829136e5953e718ed.tar.gz servo-7af5a7fd5409ab8db0274eb829136e5953e718ed.zip |
Untry script
Diffstat (limited to 'components/script/dom/location.rs')
-rw-r--r-- | components/script/dom/location.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index cac2322be82..c725e6cee54 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -70,7 +70,7 @@ impl Location { impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign fn Assign(&self, url: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; // TODO: per spec, we should use the _API base URL_ specified by the // _entry settings object_. let base_url = self.window.get_url(); @@ -84,7 +84,7 @@ impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-reload fn Reload(&self) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.window.load_url(self.get_url(), true, true, None); Ok(()) } @@ -105,7 +105,7 @@ impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-hash fn GetHash(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Hash(&self.get_url())) } @@ -114,46 +114,46 @@ impl LocationMethods for Location { if value.0.is_empty() { value = USVString("#".to_owned()); } - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetHash); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-host fn GetHost(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Host(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-host fn SetHost(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetHost); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-origin fn GetOrigin(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Origin(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn GetHostname(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Hostname(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn SetHostname(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetHostname); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-href fn GetHref(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Href(&self.get_url())) } @@ -170,57 +170,57 @@ impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn GetPathname(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Pathname(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn SetPathname(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetPathname); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-port fn GetPort(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Port(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-port fn SetPort(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetPort); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn GetProtocol(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Protocol(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn SetProtocol(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetProtocol); Ok(()) } // https://html.spec.whatwg.org/multipage/#dom-location-href fn Stringifier(&self) -> Fallible<DOMString> { - Ok(DOMString::from(try!(self.GetHref()).0)) + Ok(DOMString::from(self.GetHref()?.0)) } // https://html.spec.whatwg.org/multipage/#dom-location-search fn GetSearch(&self) -> Fallible<USVString> { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; Ok(UrlHelper::Search(&self.get_url())) } // https://html.spec.whatwg.org/multipage/#dom-location-search fn SetSearch(&self, value: USVString) -> ErrorResult { - try!(self.check_same_origin_domain()); + self.check_same_origin_domain()?; self.set_url_component(value, UrlHelper::SetSearch); Ok(()) } |