From 8ab073828a4d802d2e4c97e28fc548c93d24c6c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 29 Nov 2025 00:17:49 +0000 Subject: [PATCH] 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 --- packages/webamp/js/skinParserUtils.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/webamp/js/skinParserUtils.ts b/packages/webamp/js/skinParserUtils.ts index cf29c5fd..5efac9f1 100644 --- a/packages/webamp/js/skinParserUtils.ts +++ b/packages/webamp/js/skinParserUtils.ts @@ -55,15 +55,12 @@ export async function getFileFromZip( } } -async function fallbackGetImgFromBlob(blob: Blob): Promise { - 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 { + // 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(