diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 09247103d0c2..0ea79a8a78d0 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 { - self.performance.or_init(|| { - let global_scope = self.upcast::(); - 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::(); + 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::(); + 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(); } diff --git a/tests/wpt/metadata/html/cross-origin-embedder-policy/blob.https.html.ini b/tests/wpt/metadata/html/cross-origin-embedder-policy/blob.https.html.ini index 1b1c0ac98226..8fc5b2f04816 100644 --- a/tests/wpt/metadata/html/cross-origin-embedder-policy/blob.https.html.ini +++ b/tests/wpt/metadata/html/cross-origin-embedder-policy/blob.https.html.ini @@ -1,4 +1,5 @@ [blob.https.html] + expected: CRASH [Cross-Origin-Embedder-Policy and blob: URL from https://web-platform.test:8443 in subframe via subframe] expected: FAIL