Transfer ReadableStream (#36181)

<!-- Please describe your changes on the following line: -->

Add transfer support to ReadableStream. Part of
https://github.com/servo/servo/issues/34676

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
Gregory Terzian 2025-04-15 15:39:26 +08:00 committed by GitHub
parent c9489ca04f
commit f8b6b9f7b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 983 additions and 75 deletions

18
tests/wpt/include.ini vendored
View file

@ -234,6 +234,24 @@ skip: true
skip: false
[readable-byte-streams]
skip: false
[transferable]
skip: false
[service-worker.https.html]
skip: true
[shared-worker.html]
skip: true
[transform-stream-members.any.shadowrealm-in-dedicatedworker.html]
skip: true
[transform-stream-members.any.shadowrealm-in-shadowrealm.html]
skip: true
[transform-stream-members.any.shadowrealm-in-sharedworker.html]
skip: true
[transform-stream-members.any.shadowrealm-in-window.html]
skip: true
[transform-stream-members.https.any.shadowrealm-in-audioworklet.html]
skip: true
[transform-stream-members.https.any.shadowrealm-in-serviceworker.html]
skip: true
[writable-streams]
skip: false
[subresource-integrity]

View file

@ -5,9 +5,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Object with a getter that throws]
expected: FAIL
@ -73,9 +70,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Object with a getter that throws]
expected: FAIL

View file

@ -50,9 +50,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Object with a getter that throws]
expected: FAIL

View file

@ -5,9 +5,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Object with a getter that throws]
expected: FAIL
@ -67,9 +64,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED
[Object with a getter that throws]
expected: FAIL

View file

@ -0,0 +1,7 @@
[deserialize-error.window.html]
expected: ERROR
[a WritableStream deserialization failure should result in a DataCloneError]
expected: TIMEOUT
[a ReadableStream deserialization failure should result in a DataCloneError]
expected: TIMEOUT

View file

@ -0,0 +1,3 @@
[reason.html]
[DOMException errors should be preserved]
expected: FAIL

View file

@ -0,0 +1,4 @@
[service-worker.https.html]
expected: ERROR
[service-worker]
expected: NOTRUN

View file

@ -0,0 +1,6 @@
[shared-worker.html]
[worker.postMessage should be able to transfer a ReadableStream]
expected: FAIL
[postMessage in a worker should be able to transfer a ReadableStream]
expected: FAIL

View file

@ -0,0 +1,18 @@
[transfer-with-messageport.window.html]
[Transferring a MessagePort with a WritableStream should set `.ports`]
expected: FAIL
[Transferring a MessagePort with a TransformStream should set `.ports`]
expected: FAIL
[Transferring a MessagePort with a WritableStream should set `.ports`, advanced]
expected: FAIL
[Transferring a MessagePort with a TransformStream should set `.ports`, advanced]
expected: FAIL
[Transferring a MessagePort with multiple streams should set `.ports`]
expected: FAIL
[TransformStream must not be serializable]
expected: FAIL

View file

@ -0,0 +1,23 @@
[transform-stream-members.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[transform-stream-members.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[transform-stream-members.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[transform-stream-members.any.shadowrealm-in-window.html]
expected: ERROR
[transform-stream-members.any.html]
expected: ERROR
[transform-stream-members.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[transform-stream-members.any.worker.html]
expected: ERROR
[transform-stream-members.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR

View file

@ -0,0 +1,15 @@
[transform-stream.html]
[window.postMessage should be able to transfer a TransformStream]
expected: FAIL
[a TransformStream with a locked writable should not be transferable]
expected: FAIL
[a TransformStream with a locked readable should not be transferable]
expected: FAIL
[a TransformStream with both sides locked should not be transferable]
expected: FAIL
[piping through transferred transforms should work]
expected: FAIL

View file

@ -0,0 +1,21 @@
[writable-stream.html]
[window.postMessage should be able to transfer a WritableStream]
expected: FAIL
[window.postMessage should be able to transfer a {readable, writable} pair]
expected: FAIL
[desiredSize for a newly-transferred stream should be 1]
expected: FAIL
[effective queue size of a transferred writable should be 2]
expected: FAIL
[second write should wait for first underlying write to complete]
expected: FAIL
[abort() should work]
expected: FAIL
[writing a unclonable object should error the stream]
expected: FAIL

View file

@ -55,6 +55,3 @@
[Growable SharedArrayBuffer]
expected: FAIL
[A subclass instance will be received as its closest transferable superclass]
expected: PRECONDITION_FAILED