diff options
author | Josh Matthews <josh@joshmatthews.net> | 2024-02-23 07:18:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 12:18:49 +0000 |
commit | b182bdfa52db348fb0e9c1dcec66c0ad6e96b325 (patch) | |
tree | 7e67c64dfa24695e4d79effd6bd1df39609d7556 /components/script/dom/htmlmediaelement.rs | |
parent | e078a9981768d7523abba57b6e86f4874dcbf2fd (diff) | |
download | servo-b182bdfa52db348fb0e9c1dcec66c0ad6e96b325.tar.gz servo-b182bdfa52db348fb0e9c1dcec66c0ad6e96b325.zip |
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.
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 0b2ed564c19..e9de8cb20d5 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -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), |