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
|
@ -225,9 +225,9 @@ impl HTMLVideoElement {
|
|||
// <video poster="poster.png"></video>
|
||||
// (which triggers no media load algorithm unless a explicit call to .load() is done)
|
||||
// will block the document's load event forever.
|
||||
let mut blocker = self.load_blocker.borrow_mut();
|
||||
LoadBlocker::terminate(&mut blocker, can_gc);
|
||||
*blocker = Some(LoadBlocker::new(
|
||||
let blocker = &self.load_blocker;
|
||||
LoadBlocker::terminate(blocker, can_gc);
|
||||
*blocker.borrow_mut() = Some(LoadBlocker::new(
|
||||
&document_from_node(self),
|
||||
LoadType::Image(poster_url.clone()),
|
||||
));
|
||||
|
@ -309,13 +309,13 @@ impl ImageCacheListener for HTMLVideoElement {
|
|||
ImageResponse::Loaded(image, url) => {
|
||||
debug!("Loaded poster image for video element: {:?}", url);
|
||||
self.htmlmediaelement.process_poster_image_loaded(image);
|
||||
LoadBlocker::terminate(&mut self.load_blocker.borrow_mut(), can_gc);
|
||||
LoadBlocker::terminate(&self.load_blocker, can_gc);
|
||||
},
|
||||
ImageResponse::MetadataLoaded(..) => {},
|
||||
// The image cache may have loaded a placeholder for an invalid poster url
|
||||
ImageResponse::PlaceholderLoaded(..) | ImageResponse::None => {
|
||||
// A failed load should unblock the document load.
|
||||
LoadBlocker::terminate(&mut self.load_blocker.borrow_mut(), can_gc);
|
||||
LoadBlocker::terminate(&self.load_blocker, can_gc);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue