diff options
author | Keith Yeung <kungfukeith11@gmail.com> | 2015-02-05 19:02:04 +0800 |
---|---|---|
committer | Keith Yeung <kungfukeith11@gmail.com> | 2015-02-06 02:13:23 +0800 |
commit | af4b371107362fd1a2d7d69848a389aeb82017df (patch) | |
tree | 11e018ad0355421d9f501e8b2831c203a280ec3a /components/script/dom/window.rs | |
parent | 40c59724b2638fee3b9932eba1aa9f6ebd77b0cd (diff) | |
download | servo-af4b371107362fd1a2d7d69848a389aeb82017df.tar.gz servo-af4b371107362fd1a2d7d69848a389aeb82017df.zip |
Moved Location object from Window to Document
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index d1d76cfaa4e..7ac5ebbc5b9 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -7,6 +7,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::{OnErrorEventHandlerN use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::codegen::Bindings::WindowBinding; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; +use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::InheritTypes::EventTargetCast; use dom::bindings::global::global_object_for_js_object; use dom::bindings::error::Fallible; @@ -57,7 +58,6 @@ pub struct Window { script_chan: Box<ScriptChan+Send>, control_chan: ScriptControlChan, console: MutNullableJS<Console>, - location: MutNullableJS<Location>, navigator: MutNullableJS<Navigator>, image_cache_task: ImageCacheTask, compositor: DOMRefCell<Box<ScriptListener+'static>>, @@ -101,6 +101,10 @@ impl Window { &*self.page } + pub fn page_clone(&self) -> Rc<Page> { + self.page.clone() + } + pub fn get_url(&self) -> Url { self.page().get_url() } @@ -200,7 +204,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { } fn Location(self) -> Temporary<Location> { - self.location.or_init(|| Location::new(self, self.page.clone())) + self.Document().root().r().Location() } fn SessionStorage(self) -> Temporary<Storage> { @@ -401,7 +405,6 @@ impl Window { console: Default::default(), compositor: DOMRefCell::new(compositor), page: page, - location: Default::default(), navigator: Default::default(), image_cache_task: image_cache_task, browser_context: DOMRefCell::new(None), |