diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-08-27 23:04:25 +0200 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-08-28 00:16:22 +0200 |
commit | 344684a2f21d5ae8f7ecce943618d8674eec0a9b (patch) | |
tree | 49073d3414d2e4f8ac0280fe8aa7c52e415ad475 /components/script | |
parent | 66e5ad0cb8a7674ba0ff0a5a9a77ccc8dc3f2b0f (diff) | |
download | servo-344684a2f21d5ae8f7ecce943618d8674eec0a9b.tar.gz servo-344684a2f21d5ae8f7ecce943618d8674eec0a9b.zip |
ensure documents drop when a pipeline exits
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/window.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 09247103d0c..0ea79a8a78d 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -872,10 +872,19 @@ impl WindowMethods for Window { // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ // NavigationTiming/Overview.html#sec-window.performance-attribute fn Performance(&self) -> DomRoot<Performance> { - self.performance.or_init(|| { - let global_scope = self.upcast::<GlobalScope>(); - Performance::new(global_scope, self.navigation_start_precise.get()) - }) + match self.current_state.get() { + WindowState::Alive => self.performance.or_init(|| { + let global_scope = self.upcast::<GlobalScope>(); + Performance::new(global_scope, self.navigation_start_precise.get()) + }), + WindowState::Zombie => { + // Don't store in Zombie state, + // as clear_js_runtime has already been called, + // and we won't have another opportunity to drop it. + let global_scope = self.upcast::<GlobalScope>(); + Performance::new(global_scope, self.navigation_start_precise.get()) + }, + } } // https://html.spec.whatwg.org/multipage/#globaleventhandlers @@ -1299,6 +1308,7 @@ impl Window { self.current_state.set(WindowState::Zombie); *self.js_runtime.borrow_mut() = None; self.window_proxy.set(None); + self.performance.set(None); self.ignore_all_events(); } |