Untry script

This commit is contained in:
Simon Sapin 2017-06-18 13:21:32 +02:00
parent a5bb55790f
commit 7af5a7fd54
36 changed files with 199 additions and 199 deletions

View file

@ -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(())
}