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

@ -1998,8 +1998,6 @@ impl Drop for HTMLMediaElement {
warn!("GLPlayer disappeared!: {:?}", err);
}
}
self.remove_controls();
}
}
@ -2454,6 +2452,8 @@ impl VirtualMethods for HTMLMediaElement {
fn unbind_from_tree(&self, context: &UnbindContext) {
self.super_type().unwrap().unbind_from_tree(context);
self.remove_controls();
if context.tree_connected {
let task = MediaElementMicrotask::PauseIfNotInDocumentTask {
elem: DomRoot::from_ref(self),