fix(director): discard an asset cancelled during reader cleanup

The finally block awaits reader.cancel(), so a cancel arriving there still let
the bytes return. Rechecks the signal after cleanup, with a test that keeps the
caller's abort reason, and wraps the current-state note.
This commit is contained in:
Sameh Khamis committed 2026-10-14 19:23:12 -07:00
1 parent d42f5d4fd2
commit bf4edb5bdb
3 files changed
+42 -1

No files matched your search

+2
View File
@@ -51,6 +51,8 @@ export function createAssetDirectorySource({
await reader.cancel().catch(() => {});
reader.releaseLock();
}
// Cleanup awaits too; a cancel during it must still discard the asset.
signal?.throwIfAborted();
const bytes = new Uint8Array(length);
let offset = 0;
for (const chunk of chunks) {