mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix GC borrow hazards triggered by LoadBlocker::terminate (#34122)
* Fix GC borrow hazards triggered by LoadBlocker::terminate Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Fix clippy warnings Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Use borrow_mut() Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Revert to previous code due to crown unrooted error Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Update test expectations Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
072ff302d2
commit
cc6163dcdd
10 changed files with 34 additions and 40 deletions
|
@ -511,11 +511,12 @@ impl HTMLMediaElement {
|
|||
///
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||
pub fn delay_load_event(&self, delay: bool, can_gc: CanGc) {
|
||||
let mut blocker = self.delaying_the_load_event_flag.borrow_mut();
|
||||
if delay && blocker.is_none() {
|
||||
*blocker = Some(LoadBlocker::new(&document_from_node(self), LoadType::Media));
|
||||
} else if !delay && blocker.is_some() {
|
||||
LoadBlocker::terminate(&mut blocker, can_gc);
|
||||
let blocker = &self.delaying_the_load_event_flag;
|
||||
if delay && blocker.borrow().is_none() {
|
||||
*blocker.borrow_mut() =
|
||||
Some(LoadBlocker::new(&document_from_node(self), LoadType::Media));
|
||||
} else if !delay && blocker.borrow().is_some() {
|
||||
LoadBlocker::terminate(blocker, can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue