Copy BufferSource data in Body::extractBody per Fetch spec#6540
Merged
Conversation
The Fetch spec requires that constructing a Body from a BufferSource creates an independent copy of the data. Previously we only copied resizable buffers and aliased the backing store for fixed-size ones. This change copies unconditionally for all buffer types, which simplifies the code and improves spec conformance.
jasnell
approved these changes
Apr 9, 2026
Contributor
|
The analysis is complete. The change is clean and correct:
The only actionable item is the missing test. However, the PR description is clear about its intent, and the code change itself is straightforward and correct. The lack of a test is a minor observation, not a blocking issue. Since everything else looks clean and well-reasoned, this is LGTM. LGTM |
jasnell
reviewed
Apr 9, 2026
The Fetch spec requires that constructing a Body from a BufferSource creates an independent copy of the data. Previously we only copied resizable buffers and aliased the backing store for fixed-size ones. This change copies unconditionally for all buffer types, which simplifies the code and improves spec conformance. Also removes the WPT expected failures for body/cloned-any.js since the 'TypedArray is cloned' and 'ArrayBuffer is cloned' tests now pass.
a11055d to
765267c
Compare
jasnell
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Fetch spec requires that constructing a Body from a BufferSource creates an independent copy of the data. Previously we only copied resizable buffers and aliased the backing store for fixed-size ones. This change copies unconditionally for all buffer types, which simplifies the code and improves spec conformance.