-
Notifications
You must be signed in to change notification settings - Fork 167
Meta: implement TransferArrayBuffer correctly in reference implementation
#1353
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
Merged
domenic
merged 4 commits into
whatwg:main
from
MattiasBuelens:ref-impl-arraybuffer-transfer
Aug 19, 2025
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d68a5c7
Implement `TransferArrayBuffer` correctly in reference implementation
MattiasBuelens 3ea6daf
Fix `PullInto()` reading stale `byteLength` after transferring
MattiasBuelens 5cde2af
Roll WPT
MattiasBuelens ea326f9
Roll WPT again
MattiasBuelens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1584,6 +1584,8 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq | |
| assert(minimumFill >= elementSize && minimumFill <= view.byteLength); | ||
| assert(minimumFill % elementSize === 0); | ||
|
|
||
| const byteOffset = view.byteOffset; | ||
| const byteLength = view.byteLength; | ||
|
Comment on lines
+1587
to
+1588
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reference implementation was doing steps 8 and 9 after calling Fortunately, all "real" implementations already do this correctly. |
||
| const ctor = view.constructor; | ||
|
|
||
| let buffer; | ||
|
|
@@ -1597,8 +1599,8 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq | |
| const pullIntoDescriptor = { | ||
| buffer, | ||
| bufferByteLength: buffer.byteLength, | ||
| byteOffset: view.byteOffset, | ||
| byteLength: view.byteLength, | ||
| byteOffset, | ||
| byteLength, | ||
| bytesFilled: 0, | ||
| minimumFill, | ||
| elementSize, | ||
|
|
||
Submodule web-platform-tests
updated
6194 files
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using
transferToFixedLength()since we don't (yet) support resizableArrayBuffers.I think we can loosen that restriction, but we should do that in an actual spec change. 😉