diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-17 15:16:19 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-19 09:37:01 +0200 |
commit | 5889a75b10591172a866464cd6f349761b0741b7 (patch) | |
tree | c63222eeaac6a4ca576eae281811c9efb291f2da | |
parent | dee3aecea1edfcf8ff86f1f52bf0d70c892e2377 (diff) | |
download | servo-5889a75b10591172a866464cd6f349761b0741b7.tar.gz servo-5889a75b10591172a866464cd6f349761b0741b7.zip |
Do not root Location::window
-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(()) } |