From 51b331385488f42b5b3263e6e4e7f4af39e1ecf1 Mon Sep 17 00:00:00 2001 From: Sebastian C Date: Wed, 28 Feb 2024 17:04:20 -0600 Subject: [PATCH] fix invalid video poster image loading from panicking (#31447) This fixed #31438. When an image is loaded from cache, it will load a placeholder if the url is not a valid image url. This may be unexpected when using the image cache and specifying UsePlaceholder::No but that has no effect on loading an image not in the cache. Signed-off-by: Sebastian C --- components/script/dom/htmlvideoelement.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index a9fcd3d87ef0..1adddebd6269 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -302,8 +302,8 @@ impl ImageCacheListener for HTMLVideoElement { LoadBlocker::terminate(&mut *self.load_blocker.borrow_mut()); }, ImageResponse::MetadataLoaded(..) => {}, - ImageResponse::PlaceholderLoaded(..) => unreachable!(), - ImageResponse::None => { + // 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()); },