diff options
author | Connor Brewster <connor.brewster@eagles.oc.edu> | 2016-06-25 12:49:20 -0600 |
---|---|---|
committer | Connor Brewster <connor.brewster@eagles.oc.edu> | 2016-07-22 14:07:51 -0600 |
commit | 8d7a0c2cda0c8eb8a77046cbfc7fbbf0a626f398 (patch) | |
tree | 46699e6465a7be889a3e6fdff0c81d715924ba0f /components/script/dom/window.rs | |
parent | 05cc76370f4f8dd5c715e42549a2027dc4c8ca71 (diff) | |
download | servo-8d7a0c2cda0c8eb8a77046cbfc7fbbf0a626f398.tar.gz servo-8d7a0c2cda0c8eb8a77046cbfc7fbbf0a626f398.zip |
Add History interface
implement go, forward, back
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index b4984bb2a4a..2237514bd3d 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -30,6 +30,7 @@ use dom::document::Document; use dom::element::Element; use dom::event::Event; use dom::eventtarget::EventTarget; +use dom::history::History; use dom::htmliframeelement::build_mozbrowser_custom_event; use dom::location::Location; use dom::navigator::Navigator; @@ -158,6 +159,7 @@ pub struct Window { #[ignore_heap_size_of = "channels are hard"] image_cache_chan: ImageCacheChan, browsing_context: MutNullableHeap<JS<BrowsingContext>>, + history: MutNullableHeap<JS<History>>, performance: MutNullableHeap<JS<Performance>>, navigation_start: u64, navigation_start_precise: f64, @@ -475,6 +477,11 @@ impl WindowMethods for Window { self.browsing_context().active_document() } + // https://html.spec.whatwg.org/multipage/#dom-history + fn History(&self) -> Root<History> { + self.history.or_init(|| History::new(self)) + } + // https://html.spec.whatwg.org/multipage/#dom-location fn Location(&self) -> Root<Location> { self.Document().GetLocation().unwrap() @@ -1648,6 +1655,7 @@ impl Window { mem_profiler_chan: mem_profiler_chan, time_profiler_chan: time_profiler_chan, devtools_chan: devtools_chan, + history: Default::default(), browsing_context: Default::default(), performance: Default::default(), navigation_start: (current_time.sec * 1000 + current_time.nsec as i64 / 1000000) as u64, |