diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/location.rs | 6 | ||||
-rw-r--r-- | components/script/dom/webidls/Location.webidl | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 550af503d53..ba835ada146 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -4,6 +4,7 @@ use dom::bindings::codegen::Bindings::LocationBinding; use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; +use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -46,12 +47,15 @@ impl Location { impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign - fn Assign(&self, url: USVString) { + fn Assign(&self, url: USVString) -> ErrorResult { // 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) = base_url.join(&url.0) { self.window.load_url(url, false, None); + Ok(()) + } else { + Err(Error::Syntax) } } diff --git a/components/script/dom/webidls/Location.webidl b/components/script/dom/webidls/Location.webidl index 8eea1a12c31..93ab3dabba2 100644 --- a/components/script/dom/webidls/Location.webidl +++ b/components/script/dom/webidls/Location.webidl @@ -14,6 +14,7 @@ attribute USVString search; attribute USVString hash; + [Throws] void assign(USVString url); //void replace(USVString url); void reload(); |