diff options
Diffstat (limited to 'components/script/dom/location.rs')
-rw-r--r-- | components/script/dom/location.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index c366139649b..230cf2748da 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -35,33 +35,31 @@ impl Location { } fn get_url(&self) -> Url { - self.window.root().get_url() + self.window.get_url() } fn set_url_component(&self, value: USVString, setter: fn(&mut Url, USVString)) { - let window = self.window.root(); - let mut url = window.get_url(); + let mut url = self.window.get_url(); setter(&mut url, value); - window.load_url(url); + self.window.load_url(url); } } impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign fn Assign(&self, url: DOMString) { - 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(); + let base_url = self.window.get_url(); if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url) { - window.load_url(url); + self.window.load_url(url); } } // https://html.spec.whatwg.org/multipage/#dom-location-reload fn Reload(&self) { - self.window.root().load_url(self.get_url()); + self.window.load_url(self.get_url()); } // https://url.spec.whatwg.org/#dom-urlutils-hash @@ -101,9 +99,8 @@ impl LocationMethods for Location { // https://url.spec.whatwg.org/#dom-urlutils-href fn SetHref(&self, value: USVString) -> ErrorResult { - let window = self.window.root(); - if let Ok(url) = UrlParser::new().base_url(&window.get_url()).parse(&value.0) { - window.load_url(url); + if let Ok(url) = UrlParser::new().base_url(&self.window.get_url()).parse(&value.0) { + self.window.load_url(url); }; Ok(()) } |