Bug 1825763 Comment 4 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Note for me:

1. The reason behind comment #3 is that [WritableStream calls ReleaseObjects() on error](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/WritableStreamDefaultController.cpp#362) which currently is not error-aware and thus the WritableStreamToOutput implementation [just closes the stream without a proper error code](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#274). I'd like to let the ReleaseObjects aware the error condition instead of having `ErrorPropagate()` function as InputToReadableStreamAlgorithms does, but the error from the stream is returned in a JS::Value form and we need a native error code here. Not clear what to do.
1. One notable behavior change here is that the chunk type check now happens in WritableStream write algorithm instead of in ReadableStream chunk steps. That's technically a diversion from the spec as the [consume body](https://fetch.spec.whatwg.org/#concept-body-consume-body) algorithm of Fetch spec uses [read all bytes](https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes) algorithm. That means it takes extra time to get the error as we need to wait for WritableStream to process the write queue. Maybe we can pass an extra parameter to PipeToPump to do the check in PipeToReadRequest::ChunkSteps.
Note for me:

1. The reason behind comment #3 is that [WritableStream calls ReleaseObjects() on error](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/WritableStreamDefaultController.cpp#362) which currently is not error-aware and thus the WritableStreamToOutput implementation [just closes the stream without a proper error code](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#274). I'd like to let the ReleaseObjects aware the error condition instead of having `ErrorPropagate()` function as InputToReadableStreamAlgorithms does, but the error from the stream is returned in a JS::Value form and we need a native error code here. Not clear what to do.
1. One notable behavior change here is that the chunk type check now happens in WritableStream write algorithm instead of in [ReadableStream chunk steps of FetchStreamReader](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/fetch/FetchStreamReader.cpp#321-325). That's technically a diversion from the spec as the [consume body](https://fetch.spec.whatwg.org/#concept-body-consume-body) algorithm of Fetch spec uses [read all bytes](https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes) algorithm. That means it takes extra time to get the error as we need to wait for WritableStream to process the write queue. Maybe we can pass an extra parameter to PipeToPump to do the check in PipeToReadRequest::ChunkSteps.
Note for me:

1. The reason behind comment #3 is that [WritableStream calls ReleaseObjects() on error](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/WritableStreamDefaultController.cpp#362) which currently is not error-aware and thus the WritableStreamToOutput implementation [just closes the stream without a proper error code](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#274). I'd like to let the ReleaseObjects aware the error condition instead of having `ErrorPropagate()` function as InputToReadableStreamAlgorithms does, but the error from the stream is returned in a JS::Value form and we need a native error code here. Not clear what to do.
1. One notable behavior change here is that the chunk type check now happens in [WritableStream write algorithm of WritableStreamToOutput](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#188-192) instead of in [ReadableStream chunk steps of FetchStreamReader](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/fetch/FetchStreamReader.cpp#321-325). That's technically a diversion from the spec as the [consume body](https://fetch.spec.whatwg.org/#concept-body-consume-body) algorithm of Fetch spec uses [read all bytes](https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes) algorithm. That means it takes extra time to get the error as we need to wait for WritableStream to process the write queue. Maybe we can pass an extra parameter to PipeToPump to do the check in PipeToReadRequest::ChunkSteps.
Note for me:

1. The reason behind comment #3 is that [WritableStream calls ReleaseObjects() on error](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/WritableStreamDefaultController.cpp#362) which currently is not error-aware and thus the WritableStreamToOutput implementation [just closes the stream without a proper error code](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#274). I'd like to let the ReleaseObjects aware the error condition instead of having `ErrorPropagate()` function as InputToReadableStreamAlgorithms does, but the error from the stream is returned in a JS::Value form and we need a native error code here. Not clear what to do.
1. One notable behavior change here is that the chunk type check now happens in [WritableStream write algorithm of WritableStreamToOutput](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/UnderlyingSinkCallbackHelpers.cpp#188-192) instead of in [ReadableStream chunk steps of FetchStreamReader](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/fetch/FetchStreamReader.cpp#321-325). That's technically a diversion from the spec as the [consume body](https://fetch.spec.whatwg.org/#concept-body-consume-body) algorithm of Fetch spec uses [read all bytes](https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes) algorithm. That means it takes extra time to get the error as we need to wait for WritableStream to process the write queue. Maybe we can pass an extra parameter to PipeToPump to do the check in [PipeToReadRequest::ChunkSteps](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/dom/streams/ReadableStreamPipeTo.cpp#652).

Back to Bug 1825763 Comment 4