aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs8
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,