New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizable ArrayBuffers and Response and Request objects #1560
Comments
The constructor eventually gets the contents of the ArrayBuffer via https://fetch.spec.whatwg.org/#concept-bodyinit-extract, which calls https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy . So any changes after calling Hope this helps! |
Yep that helps! |
Huh wait. Wouldn't it throw due to it not having [AllowResizable]? @syg please add a test for this. Reopening for now until we have clarity. |
Ah yeah, I think I skipped over the resizable part and over-focused on the mutation-after-passing part. My bad! |
Done as part of https://chromium-review.googlesource.com/c/chromium/src/+/4082152 |
In case someone stumbles across this in the future, the corresponding HTML PR is whatwg/html#8559. |
@domenic @annevk ... Wondering what the expected behavior should be here with the upcoming introduction of resizable ArrayBuffers.
Assuming something like the following:
What should be expect the
Content-Length
and payload content ofresp
to be?\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000
hellothe\0000\0000
hellothe
Should the
u8
/ab
become detached when passed tonew Response(...)
? If not, why not? Could we potentially look at detaching as an option?Does the spec need to be updated to account for resizable ArrayBuffer?
I should acknowledge that yes, I'm very aware there is already potential for weirdness here allowing TypedArrays/ArrayBuffers used with
Response
andRequest
to be modified after they have been passed in but before they are consumed, resizable ArrayBuffers just makes it potentially a bit weirder. I'll note that browsers, Deno, and Node.js all appear to copy the value passed in immediately and do not pick up changes made to the ArrayBuffer after the fact (that is, they currently appear to implement option 1) but in Workers we'd currently end up with Option 2, so I want to verify what is the expected correct behavior?The text was updated successfully, but these errors were encountered: