Skip to content

writeFSAToStream neither awaits writer.close() nor aborts the stream on failure #136

Closed

Description

@Nawid3333

Severity: low

Where: chrome/player/utils/FastStreamArchiveUtils.mjs (writeFSAToStream, the final writer.close();), caller chrome/player/ui/SaveManager.mjs (dumpBuffer)

What happens

writer.close(); at the end of writeFSAToStream is not awaited, and the throw new Error('Entry is not complete!') and any getDataFromBlob/write rejection leave the writer locked and the OPFS save stream (saveBegin's open sync access handle in StreamSaver) open. dumpBuffer shows player_archiver_saved right after writeFSAToStream resolves.

Failure scenario

The "saved" message appears before the OPFS saveEnd/downloadURL have even run; a failure in the sink's close() (quota, download refused) becomes an unhandled rejection with no status message. On a thrown error the StreamSaver's FSBlob worker, session directory and open handle live until the tab closes.

Suggested fix

await writer.close() inside the try; await writer.abort(e) in a catch before rethrowing.

Confidence: high.


From a line-by-line code review of the tree at 41363fd (2026-10-02). Each claim above was checked against the source before filing; the reproduction steps and line references are as of that commit.


Generated by Claude Code

Activity

  1. added
    bugSomething isn't working
    code-reviewFound by the 2026-10-02 line-by-line review
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-reviewFound by the 2026-10-02 line-by-line review

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions