Skip to content

Dom: Re-implement ReadableStream Part 1 : Default Reader and Controller#34064

Merged
sagudev merged 47 commits intomainfrom
readablestream-re-implementation
Dec 17, 2024
Merged

Dom: Re-implement ReadableStream Part 1 : Default Reader and Controller#34064
sagudev merged 47 commits intomainfrom
readablestream-re-implementation

Conversation

@gterzian
Copy link
Copy Markdown
Member

@gterzian gterzian commented Oct 30, 2024

First part of #29088

Corresponding to #32898


  • There are tests for these changes

@gterzian gterzian force-pushed the readablestream-re-implementation branch from 97316af to 13a6c4a Compare October 30, 2024 09:11
@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Oct 30, 2024

@Taym95 @wusyong I have rebased, but the new CanGc stuff I intentially did "wrong", by calling CanGc::note() where it was needed, instead of making it flow down from the original call. Leaving this as a TODO as part of clearning-up this branch.

There are also a couple of more TODO's in the code we need to address(at least one constructor, and the removing of native calls part of #32898)

I've added these as TODOs to #32898

@mrobinson mrobinson changed the title Readablestream re implementation - the Default reader and controller part dom: Re-implement ReadableStream Part 1 : Default Reader and Controller Oct 30, 2024
@gterzian gterzian changed the title dom: Re-implement ReadableStream Part 1 : Default Reader and Controller Re-implement ReadableStream Part 1 : Default Reader and Controller Oct 30, 2024
@gterzian gterzian changed the title Re-implement ReadableStream Part 1 : Default Reader and Controller Dom Re-implement ReadableStream Part 1 : Default Reader and Controller Oct 30, 2024
@gterzian gterzian changed the title Dom Re-implement ReadableStream Part 1 : Default Reader and Controller Dom: Re-implement ReadableStream Part 1 : Default Reader and Controller Oct 30, 2024
@sagudev
Copy link
Copy Markdown
Member

sagudev commented Nov 1, 2024

I fixed streams feature in mozjs to properly hide readablestream things behind streams feature.

@gterzian gterzian force-pushed the readablestream-re-implementation branch from da9c79b to b460d74 Compare November 1, 2024 08:49
@gterzian gterzian added the T-linux-wpt Do a try run of the WPT label Nov 1, 2024
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Nov 1, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2024

🔨 Triggering try run (#11626946713) for Linux WPT

@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Nov 1, 2024

I am currently debugging the "Controller must have a stream when the should pull algo is called into." CRASH of tee.any.js. See #34097

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2024

⚠️ Try run (#11626946713) failed.

@sagudev
Copy link
Copy Markdown
Member

sagudev commented Nov 1, 2024

@sagudev
Copy link
Copy Markdown
Member

sagudev commented Nov 1, 2024

btw we also need to use_builtin_readable_stream=False when init webidl parser: sagudev@8f71968#diff-27c57f586c93e0626e7e988aeb22181aec12a417825fd07c922250538de52cc3R23

@gterzian
Copy link
Copy Markdown
Member Author

Current status of the readablestream suite(which does not include fetch and other suites using streams):

Screenshot 2024-11-15 at 1 32 28 PM

Note the absence of crashes.

@Taym95 Taym95 mentioned this pull request Nov 15, 2024
5 tasks
@Taym95 Taym95 force-pushed the readablestream-re-implementation branch from 6b8567b to ff9fcc2 Compare November 18, 2024 16:04
@gterzian
Copy link
Copy Markdown
Member Author

At the next rebase, we can add the --signoff flag to fix that one failing check.

@gterzian
Copy link
Copy Markdown
Member Author

Screenshot 2024-11-22 at 1 36 24 PM

Nice! /streams/readable-streams/templated.any.html is not only back to where it was, but we're apparently more correct than the old SM implementation by one test.

@Taym95 Taym95 added the T-linux-wpt Do a try run of the WPT label Dec 9, 2024
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Dec 9, 2024
gterzian and others added 19 commits December 17, 2024 21:54
Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
* fix error handling in cancel steps

Signed-off-by: gterzian <[email protected]>

* in pull steps, reject promise if pull algo throws

Signed-off-by: gterzian <[email protected]>

* if start algorithm fails, rethrow the error

Signed-off-by: gterzian <[email protected]>

* when the strategy size fails, directly get the pending exception and use it to error the stream

Signed-off-by: gterzian <[email protected]>

* add error handling to enqueue value with size

Signed-off-by: gterzian <[email protected]>

* when enqueueing a value errors, ensure we error and stream with the same error used to throw an exception

Signed-off-by: gterzian <[email protected]>

---------

Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
* Implement readablestreamdefaulttee

Signed-off-by: Taym <[email protected]>

* Create UnderlyingSourceType::Tee each stream

Signed-off-by: Taym <[email protected]>

* Use Dom instead of DomRoot

Signed-off-by: Taym <[email protected]>

* Queue a microtask for readRequest chunk steps

Signed-off-by: Taym <[email protected]>

* fix create_readable_stream

Signed-off-by: Taym <[email protected]>

* Remove unnecessary Rc

Signed-off-by: Taym <[email protected]>

* Use correct doc link

Signed-off-by: Taym <[email protected]>

* Add #[allow(crown::unrooted_must_root)]

Signed-off-by: Taym <[email protected]>

* Fix crash in ClosedPromiseRejectionHandler

Signed-off-by: Taym <[email protected]>

* reflect TeeReadRequest and TeeUnderlyingSource
Signed-off-by: Taym <[email protected]>

* fix can_gc

Signed-off-by: Taym <[email protected]>

* reflect tee source, and fix use of mutable dom for tee source and request

Signed-off-by: gterzian <[email protected]>

* Fix typo that resolves multiple test failures in 'Tee' tests

Signed-off-by: Taym <[email protected]>

* Fix readable-streams/tee.any.js test

Signed-off-by: Taym <[email protected]>

---------

Signed-off-by: Taym <[email protected]>
Signed-off-by: gterzian <[email protected]>
Co-authored-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
…in default-reader.any.js (#34531)

And fix crate::DomTypeHolder usage

* Align ReadableStreamDefaultReader with spec and fix additional tests in default-reader.any.js

Signed-off-by: Taym <[email protected]>

* make reader rooted in Constructor and acquire_default_reader

Signed-off-by: Taym <[email protected]>

* Remove spaces

Signed-off-by: Taym <[email protected]>

---------

Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
* fetch stream chunks should be uint8 arrays

Signed-off-by: gterzian <[email protected]>

* fix clippy

Signed-off-by: Taym Haddadi <[email protected]>

---------

Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
Co-authored-by: Taym Haddadi <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
… one reason (#34560)

Signed-off-by: gterzian <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym Haddadi <[email protected]>
* Fix compositeReason for DefaultTeeUnderlyingSource

Signed-off-by: Taym Haddadi <[email protected]>

* Update test

Signed-off-by: Taym Haddadi <[email protected]>

---------

Signed-off-by: Taym Haddadi <[email protected]>
* remove now unsused from_js method of readable stream

* fix documenation of error steps

* return type error instread of panicking on a todo, when trying to construct a stream of type bytes

Signed-off-by: gterzian <[email protected]>

---------

Signed-off-by: Gregory Terzian <[email protected]>
@sagudev sagudev force-pushed the readablestream-re-implementation branch from e028b12 to 11d511d Compare December 17, 2024 20:54
@sagudev sagudev enabled auto-merge December 17, 2024 20:55
@sagudev
Copy link
Copy Markdown
Member

sagudev commented Dec 17, 2024

Rebased in hope that #34670 fixed the problem.

@sagudev sagudev added this pull request to the merge queue Dec 17, 2024
Merged via the queue into main with commit 379bbb4 Dec 17, 2024
@sagudev sagudev deleted the readablestream-re-implementation branch December 17, 2024 22:04
@gterzian
Copy link
Copy Markdown
Member Author

@sagudev Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ReadableStream: finish default controller and reader impl

5 participants