Script Implement ReadableByteStreamTee#35991
Conversation
|
Is this one ready for review? |
Yes ready, sorry forgot about it |
gterzian
left a comment
There was a problem hiding this comment.
LGTM with a couple of questions.
| if result.is_null() { | ||
| rooted!(in(*cx) let mut rval = UndefinedValue()); | ||
| assert!(JS_GetPendingException(*cx, rval.handle_mut().into())); | ||
| JS_ClearPendingException(*cx); |
There was a problem hiding this comment.
It seems to me that the duplication of these three lines for all arms could be removed if you move it to outside this match before returning the result.
| can_gc: CanGc, | ||
| ) { | ||
| let mut reader = self.reader.borrow_mut(); | ||
| match &*reader { |
There was a problem hiding this comment.
This doesn't seem correct: I think it should be an if &*reader == eaderType::BYOB(byte_reader), followed by "Let readRequest be a read request with the following items:" that should run for both reader types.
There was a problem hiding this comment.
read request is readerType::Default specific, BYOB reader has read_into.
| can_gc, | ||
| ); | ||
| }, | ||
| ReaderType::Default(default_reader) => { |
There was a problem hiding this comment.
Same here, you want to run the "If reader implements ReadableStreamDefaultReader" only for ReaderType::Default, but the other steps should run for both types.
There was a problem hiding this comment.
same here read_into is ReaderType::BYOB specific.
| let this_reader = this_reader.borrow_mut(); | ||
| match &*this_reader { | ||
| ReaderType::Default(_reader) => { | ||
| // TODO |
There was a problem hiding this comment.
Is the logic not the same for both readers? Seems like it would be worth making byte_tee_append_native_handler_to_closed_promise a function taking all the arguments, including the closed_promised from the reader.
| /// Upon rejection of `reader.closedPromise` with reason `r``, | ||
| fn callback(&self, _cx: SafeJSContext, v: SafeHandleValue, _realm: InRealm, can_gc: CanGc) { | ||
| // If thisReader is not reader, return. | ||
| // TODO: Implement this check. |
There was a problem hiding this comment.
For this I think you would have to add the this_reader: Rc<RefCell<ReaderType>> and also the &self reader from when forward_reader_error was called. Could be a TODO indeed, we should note it in the issue.
| ); | ||
| } | ||
|
|
||
| /// <https://streams.spec.whatwg.org/#read-request-chunk-steps> |
There was a problem hiding this comment.
| ); | ||
| } | ||
|
|
||
| /// <https://streams.spec.whatwg.org/#read-request-chunk-steps> |
There was a problem hiding this comment.
There was a problem hiding this comment.
I always have hard time founding these links!
| } | ||
| } | ||
|
|
||
| /// <https://streams.spec.whatwg.org/#read-request-close-steps> |
There was a problem hiding this comment.
| self.cancel_promise.resolve_native(&(), can_gc); | ||
| } | ||
| } | ||
| /// <https://streams.spec.whatwg.org/#read-request-error-steps> |
There was a problem hiding this comment.
| } | ||
| } | ||
|
|
||
| /// <https://streams.spec.whatwg.org/#read-request-close-steps> |
There was a problem hiding this comment.
| } | ||
| } | ||
| /// <https://streams.spec.whatwg.org/#read-request-error-steps> | ||
| pub(crate) fn error_steps(&self) { |
There was a problem hiding this comment.
|
🔨 Triggering try run (#14419627106) for Linux (WPT) |
|
|
ed97eb0 to
531f053
Compare
|
🔨 Triggering try run (#14537679420) for Linux (WPT) |
|
Test results for linux-wpt from try job (#14537679420): Flaky unexpected result (19)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (4)
|
|
|
|
@Taym95 Do you plan to land this? It's gotten quite stale. |
Yes, I will get back to this in the next few days. |
531f053 to
c61a34d
Compare
c61a34d to
2924564
Compare
|
🔨 Triggering try run (#19392271271) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19392271271): Flaky unexpected result (35)
Stable unexpected results that are known to be intermittent (27)
Stable unexpected results (5)
|
|
|
Signed-off-by: Taym Haddadi <[email protected]>
2924564 to
eafdb0b
Compare
|
🔨 Triggering try run (#19894787408) for Linux (WPT) |
|
I finally had some time to revisit this. All tests/wpt/meta/streams/readable-byte-streams/tee.any.js.ini tests are now passing, and stream tee is fully supported. 🎉, This will improve the fetch spec compliance #40825 |
Signed-off-by: Taym Haddadi <[email protected]>
|
Test results for linux-wpt from try job (#19894787408): Flaky unexpected result (35)
Stable unexpected results that are known to be intermittent (27)
|
|
✨ Try run (#19894787408) succeeded. |

./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsAll stream tee tests are passing now.