Fix crash when closing window containing video element (#31413)

* Forbid casting DOM objects when JS runtime is shutting down.

* Remove media controls from document when element is removed from the tree.
This commit is contained in:
Josh Matthews 2024-02-23 07:18:49 -05:00 committed by GitHub
parent e078a99817
commit b182bdfa52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 2 deletions

View file

@ -812,6 +812,10 @@ thread_local!(
static THREAD_ACTIVE: Cell<bool> = Cell::new(true);
);
pub(crate) fn runtime_is_alive() -> bool {
THREAD_ACTIVE.with(|t| t.get())
}
#[allow(unsafe_code)]
unsafe extern "C" fn trace_rust_roots(tr: *mut JSTracer, _data: *mut os::raw::c_void) {
if !THREAD_ACTIVE.with(|t| t.get()) {