18:04 | <akaster> | Any chance we can get some more eyes on <https://github.com/whatwg/fetch/issues/1754>; ? Resolving it would unblock a ton of fetch progress for ladybird. |
18:06 | <akaster> | I believe this comment has the most minimized reproducer of the problem https://github.com/LadybirdBrowser/ladybird/pull/2162#issuecomment-2521178568 |
20:50 | <Noam Rosenthal> | akaster: when we "fully read" the body, we get it as bytes, and then "safely extracting" bytes creates a new stream. It's not the same stream that you've read |
20:58 | <Noam Rosenthal> | ... The act of "fully reading" a body turns it into bytes and creates a fresh stream with no readers. Later hand over pipes that fresh stream for the "end of body" callback |
20:58 | <Noam Rosenthal> | This way, you can "fully read" a body multiple times :) |
20:59 | <Noam Rosenthal> | (I added the exact algo steps on the github issue, but of course there could always be missing bits and bobs) |
21:01 | <akaster> | Thanks! I'll take a look. Hopefully that's something we can slot in to our implementation, because that sounds like it would avoid the issue as I've had it described to me |
21:02 | <Noam Rosenthal> | Good luck! |
23:19 | <akaster> | well, I rebased the branch that folks were working on and the issue from the reproducer is still there. The steps you mentioned for how fetch_response_handover gets its own stream seem to be followed to the letter of the spec, so something else must be going on |
23:23 | <akaster> | I did notice that a handful of algorithms in the streams spec seem to call both https://webidl.spec.whatwg.org/#upon-fulfillment and https://webidl.spec.whatwg.org/#upon-rejection, which ends up invoking https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled twice in a row, and doing something different each time. which is probably not optimal (and in our implementation creates a bunch of extra PromiseCapabilities that are not used) |
23:48 | <akaster> | aha. currently in https://streams.spec.whatwg.org/#readable-stream-pipe-to, we call https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes |
23:49 | <akaster> | instead of doing... whatever spec step 15 of ReadableStreamPipeTo is trying to convey. "move the bytes over somehow idk" seems to be what it wants to say |