aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorAlan Jeffrey <ajeffrey@mozilla.com>2017-09-20 13:47:12 -0500
committerAlan Jeffrey <ajeffrey@mozilla.com>2017-09-20 14:20:04 -0500
commit3d00b0e2ac3920124df0820c09167dd741920717 (patch)
tree99ca132a4872eaece6459f105d66835e866da65a /components/script/dom/window.rs
parenteefd59e9332ea054908548eaba63ac12ff4bf46c (diff)
downloadservo-3d00b0e2ac3920124df0820c09167dd741920717.tar.gz
servo-3d00b0e2ac3920124df0820c09167dd741920717.zip
Window should own Location, Document shouldn't
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 1cb38d0a7ca..7ad5d0c02ac 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -183,6 +183,7 @@ pub struct Window {
image_cache_chan: Sender<ImageCacheMsg>,
window_proxy: MutNullableJS<WindowProxy>,
document: MutNullableJS<Document>,
+ location: MutNullableJS<Location>,
history: MutNullableJS<History>,
custom_element_registry: MutNullableJS<CustomElementRegistry>,
performance: MutNullableJS<Performance>,
@@ -568,7 +569,7 @@ impl WindowMethods for Window {
// https://html.spec.whatwg.org/multipage/#dom-location
fn Location(&self) -> Root<Location> {
- self.Document().GetLocation().unwrap()
+ self.location.or_init(|| Location::new(self))
}
// https://html.spec.whatwg.org/multipage/#dom-sessionstorage
@@ -1854,6 +1855,7 @@ impl Window {
image_cache_chan,
image_cache,
navigator: Default::default(),
+ location: Default::default(),
history: Default::default(),
custom_element_registry: Default::default(),
window_proxy: Default::default(),