diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-28 08:55:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-28 08:55:17 -0400 |
commit | 3ade7b680d2d17fb849d10fd69acd7a3010ed8e4 (patch) | |
tree | e997c704a33cbca91148bc286c5d1f365af09587 /components/script/dom | |
parent | 1af15054e77acb644c573e3252274652c72e7751 (diff) | |
parent | 344684a2f21d5ae8f7ecce943618d8674eec0a9b (diff) | |
download | servo-3ade7b680d2d17fb849d10fd69acd7a3010ed8e4.tar.gz servo-3ade7b680d2d17fb849d10fd69acd7a3010ed8e4.zip |
Auto merge of #24072 - gterzian:ensure_docs_drop, r=asajeffrey
Ensure documents drop when a pipeline exits
<!-- Please describe your changes on the following line: -->
minimalist companion/alternative to https://github.com/servo/servo/pull/24047
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24072)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-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 933799dc067..ac261879079 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(); } |