whatwg / fs

File System Standard
https://fs.spec.whatwg.org/
Other
238 stars 20 forks source link

Errors when multiple async operations are pending on WritableFileStream #51

Closed jesup closed 2 years ago

jesup commented 2 years ago

Can multiple async operations be pending for WritableFileStream? I presume so. If so, what happens to following operations if one has an error? (Right now I presume nothing happens to them; they run as normal.) We could, for example, abort all queued tasks for the stream on error.

a-sully commented 2 years ago

Can multiple async operations be pending for WritableFileStream? I presume so.

There's a WPT asserting that operations can be queued. Is that what you're looking for or am I misinterpreting your question?

If so, what happens to following operations if one has an error? (Right now I presume nothing happens to them; they run as normal.) We could, for example, abort all queued tasks for the stream on error.

I assume the stream goes into an errored state and all further operations are rejected... we should probably match the behavior of WritableStreamDefaultWriter if we don't already.

@domenic this seems like something that should be specified in the Streams spec? (and also probably on the FileSystemWritableFileStream::write() method in this spec)

domenic commented 2 years ago

Yep, this is all well-specified in streams already. I don't think any new spec text is needed here or there.

a-sully commented 2 years ago

Could you point me to where this is specified in Streams? It looks like behavior after calling abort() is specified, but I'm not seeing anything about what happens when write() itself fails. At minimum, we could link there from this spec?

domenic commented 2 years ago

https://streams.spec.whatwg.org/#writable-stream-default-controller-process-write step 5

domenic commented 2 years ago

Tests: https://github.com/web-platform-tests/wpt/blob/master/streams/writable-streams/write.any.js#L110-L155 and similar

annevk commented 2 years ago

@jesup can this be closed per the above comments?

jesup commented 2 years ago

yes