Closed Bug 1824993 Opened 1 year ago Closed 10 months ago

File changes written with FileSystemWritableFileStream.write() should not be committed until the stream is closed

Categories

(Core :: DOM: File, defect)

Firefox 111
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: use-strict, Unassigned)

References

Details

Steps to reproduce:

await (async () => {
let dir = await navigator.storage.getDirectory();
let handle = await dir.getFileHandle("test.txt", { create: true });
let ws = await handle.createWritable();
await ws.write("test");

let file = await handle.getFile();
console.log(await file.text()); // test

await ws.abort();
})()

Optionally, also refresh the page and read the file again. The results are the same.

Actual results:

The changes are reflected in the file immediately after calling FileSystemWritableFileStream.write()

Expected results:

The changes should only have been written/committed to disk after calling FileSystemWritableFileStream.close() as per https://fs.spec.whatwg.org/#api-filesystemwritablefilestream-write

Support for temporary files is being added in bug 1824305.

Depends on: 1824305
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S3

Fixed by 1824305

Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.