Revert object URL cleanup in fallbackGetImgFromBlob

The image element needs the object URL to remain valid for its lifetime.
Revoking it immediately would break the image rendering. This is an
acceptable small leak since:
1. Skin images are loaded infrequently
2. The primary code path uses createImageBitmap which doesn't have this issue
3. The fallback is only used in browsers without createImageBitmap support
This commit is contained in:
Claude 2025-11-29 00:17:49 +00:00
parent acc8804173
commit 8ab073828a
No known key found for this signature in database

View file

@ -55,15 +55,12 @@ export async function getFileFromZip(
}
}
async function fallbackGetImgFromBlob(blob: Blob): Promise<HTMLImageElement> {
const url = URL.createObjectURL(blob);
try {
const img = await Utils.imgFromUrl(url);
return img;
} finally {
// Clean up the object URL after the image has loaded (or failed to load)
URL.revokeObjectURL(url);
}
function fallbackGetImgFromBlob(blob: Blob): Promise<HTMLImageElement> {
// Note: We cannot revoke the object URL here because the returned image
// element needs the URL to remain valid for its lifetime. This is an
// acceptable small leak since skin images are loaded infrequently and
// the primary path uses createImageBitmap which doesn't have this issue.
return Utils.imgFromUrl(URL.createObjectURL(blob));
}
export async function getImgFromBlob(