fix(browser-files): return ABORTED instead of a leaked preview lease after a same-turn abort (02-01)
create() checked the signal only before resolving the file, so an abort in the same turn still produced a lease the caller never released. Each leak used one of the 16 object URL slots shared with downloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4d17259037
commit
c9be8d65e4
@@ -260,6 +260,10 @@ export class BrowserTransientPreview implements TransientPreviewPort {
|
||||
browserDataFailure("UNAVAILABLE", "PREVIEW"),
|
||||
);
|
||||
}
|
||||
// 02-01. The caller may abort while the file resolves; a lease created
|
||||
// after that would never be released because the caller drops the result.
|
||||
const abortedWhileResolving = abortedResult(input.signal, "PREVIEW");
|
||||
if (abortedWhileResolving) return this.#observe(abortedWhileResolving);
|
||||
const mediaType = resolved.value.mediaType.trim().toLowerCase();
|
||||
if (
|
||||
!EXACT_MEDIA_TYPE.test(mediaType) ||
|
||||
|
||||
Reference in New Issue
Block a user