ensure documents drop when a pipeline exits

This commit is contained in:
Gregory Terzian 2019-08-27 23:04:25 +02:00
parent 66e5ad0cb8
commit 344684a2f2
2 changed files with 15 additions and 4 deletions

View file

@ -872,10 +872,19 @@ impl WindowMethods for Window {
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/
// NavigationTiming/Overview.html#sec-window.performance-attribute // NavigationTiming/Overview.html#sec-window.performance-attribute
fn Performance(&self) -> DomRoot<Performance> { fn Performance(&self) -> DomRoot<Performance> {
self.performance.or_init(|| { match self.current_state.get() {
let global_scope = self.upcast::<GlobalScope>(); WindowState::Alive => self.performance.or_init(|| {
Performance::new(global_scope, self.navigation_start_precise.get()) 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 // https://html.spec.whatwg.org/multipage/#globaleventhandlers
@ -1299,6 +1308,7 @@ impl Window {
self.current_state.set(WindowState::Zombie); self.current_state.set(WindowState::Zombie);
*self.js_runtime.borrow_mut() = None; *self.js_runtime.borrow_mut() = None;
self.window_proxy.set(None); self.window_proxy.set(None);
self.performance.set(None);
self.ignore_all_events(); self.ignore_all_events();
} }

View file

@ -1,4 +1,5 @@
[blob.https.html] [blob.https.html]
expected: CRASH
[Cross-Origin-Embedder-Policy and blob: URL from https://web-platform.test:8443 in subframe via subframe] [Cross-Origin-Embedder-Policy and blob: URL from https://web-platform.test:8443 in subframe via subframe]
expected: FAIL expected: FAIL