diff options
Diffstat (limited to 'components/script/dom/location.rs')
-rw-r--r-- | components/script/dom/location.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 1d9f291c057..69cfb4b7d5b 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -13,7 +13,7 @@ use dom::window::Window; use dom::window::WindowHelpers; use util::str::DOMString; -use url::Url; +use url::{Url, UrlParser}; #[dom_struct] pub struct Location { @@ -39,7 +39,13 @@ impl Location { impl<'a> LocationMethods for &'a Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign fn Assign(self, url: DOMString) { - self.window.root().r().load_url(url); + let window = self.window.root(); + // TODO: per spec, we should use the _API base URL_ specified by the + // _entry settings object_. + let base_url = window.get_url(); + if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url) { + window.load_url(url); + } } // https://url.spec.whatwg.org/#dom-urlutils-hash |