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 <sebsebmc@gmail.com>
This commit is contained in:
Sebastian C 2024-02-28 17:04:20 -06:00 committed by GitHub
parent e2e30bcbb1
commit 51b3313854
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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());
},