script: implement ReadableByteStreamController (#35410)

* script: implement ReadableByteStreamController

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* implement can_copy_data_block_bytes and copy_data_block_bytes

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Remove BufferSource::Default

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* implement StartAlgorithmFulfillmentHandler, StartAlgorithmRejectionHandler, PullAlgorithmFulfillmentHandler, PullAlgorithmRejectionHandler for ReadableByteStreamController

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* implement perform_pull_into

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix build

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix clippy

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix build

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Remove RefCell from PullIntoDescriptor and QueueEntry

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Remove commented code

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* add perform_cancel_steps, perform_release_steps and perform_pull_steps

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix clippy

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix crown

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* unskip readable-byte-streams

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix CRASH

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix clippy

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix more CRASHS

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix more crashes

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix bad-buffers-and-views.any.js test

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Update test expectations

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix BorrowMutError crashes

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix view_byte_length  test

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix non-transferable-buffers test

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Pass contexts as much as possible by reference

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Make respond_internal Fallible

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix crwon

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* fix process pull into descriptors using queue logic and resulting double-borrow

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* Fix clippy

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* FIx more crashes

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix timeout tests

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix all tests

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Remove all error! logs

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Remove  #[allow(unsafe_code)]

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix lint
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix tidy

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Fix test expectation

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
Taym Haddadi 2025-03-10 12:43:04 -07:00 committed by GitHub
parent 459aee27b6
commit a5cf04c479
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 3410 additions and 324 deletions

View file

@ -0,0 +1,23 @@
[bad-buffers-and-views.any.serviceworker.html]
expected: ERROR
[bad-buffers-and-views.any.shadowrealm-in-window.html]
expected: ERROR
[bad-buffers-and-views.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[bad-buffers-and-views.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[bad-buffers-and-views.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[bad-buffers-and-views.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[bad-buffers-and-views.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[bad-buffers-and-views.any.sharedworker.html]
expected: ERROR

View file

@ -0,0 +1,23 @@
[construct-byob-request.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[construct-byob-request.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[construct-byob-request.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[construct-byob-request.any.shadowrealm-in-window.html]
expected: ERROR
[construct-byob-request.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[construct-byob-request.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[construct-byob-request.any.serviceworker.html]
expected: ERROR
[construct-byob-request.any.sharedworker.html]
expected: ERROR

View file

@ -0,0 +1,23 @@
[enqueue-with-detached-buffer.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[enqueue-with-detached-buffer.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[enqueue-with-detached-buffer.any.sharedworker.html]
expected: ERROR
[enqueue-with-detached-buffer.any.shadowrealm-in-window.html]
expected: ERROR
[enqueue-with-detached-buffer.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[enqueue-with-detached-buffer.any.serviceworker.html]
expected: ERROR
[enqueue-with-detached-buffer.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[enqueue-with-detached-buffer.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR

View file

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

View file

@ -0,0 +1,23 @@
[non-transferable-buffers.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[non-transferable-buffers.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[non-transferable-buffers.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[non-transferable-buffers.any.serviceworker.html]
expected: ERROR
[non-transferable-buffers.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[non-transferable-buffers.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[non-transferable-buffers.any.sharedworker.html]
expected: ERROR
[non-transferable-buffers.any.shadowrealm-in-window.html]
expected: ERROR

View file

@ -0,0 +1,23 @@
[patched-global.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[patched-global.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[patched-global.any.sharedworker.html]
expected: ERROR
[patched-global.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[patched-global.any.shadowrealm-in-window.html]
expected: ERROR
[patched-global.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[patched-global.any.serviceworker.html]
expected: ERROR
[patched-global.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR

View file

@ -0,0 +1,31 @@
[read-min.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[read-min.any.sharedworker.html]
expected: ERROR
[read-min.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[read-min.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[read-min.any.serviceworker.html]
expected: ERROR
[read-min.any.shadowrealm-in-window.html]
expected: ERROR
[read-min.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[read-min.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[read-min.any.html]
[ReadableStream with byte source: tee() with read({ min }) from branch1 and read() from branch2]
expected: FAIL
[read-min.any.worker.html]
[ReadableStream with byte source: tee() with read({ min }) from branch1 and read() from branch2]
expected: FAIL

View file

@ -0,0 +1,23 @@
[respond-after-enqueue.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[respond-after-enqueue.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[respond-after-enqueue.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[respond-after-enqueue.any.serviceworker.html]
expected: ERROR
[respond-after-enqueue.any.sharedworker.html]
expected: ERROR
[respond-after-enqueue.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[respond-after-enqueue.any.shadowrealm-in-window.html]
expected: ERROR
[respond-after-enqueue.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR

View file

@ -0,0 +1,255 @@
[tee.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[tee.any.shadowrealm-in-window.html]
expected: ERROR
[tee.any.worker.html]
[ReadableStream teeing with byte source: rs.tee() returns an array of two ReadableStreams]
expected: FAIL
[ReadableStream teeing with byte source: should be able to read one branch to the end without affecting the other]
expected: FAIL
[ReadableStream teeing with byte source: chunks should be cloned for each branch]
expected: FAIL
[ReadableStream teeing with byte source: chunks for BYOB requests from branch 1 should be cloned to branch 2]
expected: FAIL
[ReadableStream teeing with byte source: errors in the source should propagate to both branches]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should not impact branch2]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch2 should not impact branch1]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches should aggregate the cancel reasons into an array]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches in reverse order should aggregate the cancel reasons into an array]
expected: FAIL
[ReadableStream teeing with byte source: failing to cancel the original stream should cause cancel() to reject on branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring a teed stream should properly handle canceled branches]
expected: FAIL
[ReadableStream teeing with byte source: closing the original should close the branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should immediately error the branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should error pending reads from default reader]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should error pending reads from BYOB reader]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should finish when branch2 reads until end of stream]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should finish when original stream errors]
expected: FAIL
[ReadableStream teeing with byte source: should not pull any chunks if no branches are reading]
expected: FAIL
[ReadableStream teeing with byte source: should only pull enough to fill the emptiest queue]
expected: FAIL
[ReadableStream teeing with byte source: should not pull when original is already errored]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while branch 1 is reading]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while branch 2 is reading]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while both branches are reading]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches in sequence with delay]
expected: FAIL
[ReadableStream teeing with byte source: failing to cancel when canceling both branches in sequence with delay]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, cancel branch2]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, cancel branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, enqueue to branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, respond to branch2]
expected: FAIL
[ReadableStream teeing with byte source: pull with BYOB reader, then pull with default reader]
expected: FAIL
[ReadableStream teeing with byte source: pull with default reader, then pull with BYOB reader]
expected: FAIL
[ReadableStream teeing with byte source: read from branch2, then read from branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 with default reader, then close while branch2 has pending BYOB read]
expected: FAIL
[ReadableStream teeing with byte source: read from branch2 with default reader, then close while branch1 has pending BYOB read]
expected: FAIL
[ReadableStream teeing with byte source: close when both branches have pending BYOB reads]
expected: FAIL
[ReadableStream teeing with byte source: enqueue() and close() while both branches are pulling]
expected: FAIL
[ReadableStream teeing with byte source: respond() and close() while both branches are pulling]
expected: FAIL
[ReadableStream teeing with byte source: reading an array with a byte offset should clone correctly]
expected: FAIL
[tee.any.sharedworker.html]
expected: ERROR
[tee.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[tee.any.html]
[ReadableStream teeing with byte source: rs.tee() returns an array of two ReadableStreams]
expected: FAIL
[ReadableStream teeing with byte source: should be able to read one branch to the end without affecting the other]
expected: FAIL
[ReadableStream teeing with byte source: chunks should be cloned for each branch]
expected: FAIL
[ReadableStream teeing with byte source: chunks for BYOB requests from branch 1 should be cloned to branch 2]
expected: FAIL
[ReadableStream teeing with byte source: errors in the source should propagate to both branches]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should not impact branch2]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch2 should not impact branch1]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches should aggregate the cancel reasons into an array]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches in reverse order should aggregate the cancel reasons into an array]
expected: FAIL
[ReadableStream teeing with byte source: failing to cancel the original stream should cause cancel() to reject on branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring a teed stream should properly handle canceled branches]
expected: FAIL
[ReadableStream teeing with byte source: closing the original should close the branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should immediately error the branches]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should error pending reads from default reader]
expected: FAIL
[ReadableStream teeing with byte source: erroring the original should error pending reads from BYOB reader]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should finish when branch2 reads until end of stream]
expected: FAIL
[ReadableStream teeing with byte source: canceling branch1 should finish when original stream errors]
expected: FAIL
[ReadableStream teeing with byte source: should not pull any chunks if no branches are reading]
expected: FAIL
[ReadableStream teeing with byte source: should only pull enough to fill the emptiest queue]
expected: FAIL
[ReadableStream teeing with byte source: should not pull when original is already errored]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while branch 1 is reading]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while branch 2 is reading]
expected: FAIL
[ReadableStream teeing with byte source: stops pulling when original stream errors while both branches are reading]
expected: FAIL
[ReadableStream teeing with byte source: canceling both branches in sequence with delay]
expected: FAIL
[ReadableStream teeing with byte source: failing to cancel when canceling both branches in sequence with delay]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, cancel branch2]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, cancel branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch2, enqueue to branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 and branch2, cancel branch1, respond to branch2]
expected: FAIL
[ReadableStream teeing with byte source: pull with BYOB reader, then pull with default reader]
expected: FAIL
[ReadableStream teeing with byte source: pull with default reader, then pull with BYOB reader]
expected: FAIL
[ReadableStream teeing with byte source: read from branch2, then read from branch1]
expected: FAIL
[ReadableStream teeing with byte source: read from branch1 with default reader, then close while branch2 has pending BYOB read]
expected: FAIL
[ReadableStream teeing with byte source: read from branch2 with default reader, then close while branch1 has pending BYOB read]
expected: FAIL
[ReadableStream teeing with byte source: close when both branches have pending BYOB reads]
expected: FAIL
[ReadableStream teeing with byte source: enqueue() and close() while both branches are pulling]
expected: FAIL
[ReadableStream teeing with byte source: respond() and close() while both branches are pulling]
expected: FAIL
[ReadableStream teeing with byte source: reading an array with a byte offset should clone correctly]
expected: FAIL
[tee.any.serviceworker.html]
expected: ERROR
[tee.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[tee.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[tee.any.shadowrealm-in-shadowrealm.html]
expected: ERROR

View file

@ -0,0 +1,32 @@
[templated.https.any.shadowrealm-in-audioworklet.html]
expected: ERROR
[templated.any.shadowrealm-in-dedicatedworker.html]
expected: ERROR
[templated.any.sharedworker.html]
expected: ERROR
[templated.any.serviceworker.html]
expected: ERROR
[templated.https.any.shadowrealm-in-serviceworker.html]
expected: ERROR
[templated.any.shadowrealm-in-window.html]
expected: ERROR
[templated.any.shadowrealm-in-shadowrealm.html]
expected: ERROR
[templated.any.shadowrealm-in-sharedworker.html]
expected: ERROR
[templated.any.worker.html]
[ReadableStream with byte source (empty): instances have the correct methods and properties]
expected: FAIL
[templated.any.html]
[ReadableStream with byte source (empty): instances have the correct methods and properties]
expected: FAIL