Fall through to built-in decoding

This commit is contained in:
Surma
2021-05-21 15:13:00 +01:00
parent 8bcaeb2f78
commit 118885cd26

View File

@@ -113,7 +113,11 @@ async function decodeImage(
}
// If none of those work, lets see if Web Codecs API is available
if (await WebCodecs.isTypeSupported(mimeType)) {
return await abortable(signal, WebCodecs.decode(blob, mimeType));
let result;
try {
result = await abortable(signal, WebCodecs.decode(blob, mimeType));
return result;
} catch (e) {}
}
// Otherwise fall through and try built-in decoding for a laugh.
return await abortable(signal, builtinDecode(blob));