Implement ReadableStreamDefaultReader#33160
Implement ReadableStreamDefaultReader#33160gterzian merged 2 commits intoservo:readablestream-re-implementationfrom
Conversation
gterzian
left a comment
There was a problem hiding this comment.
Thank you! I think a good next step would be to break-down the algos in their own methods where appropriate.
| fn Cancel(&self, _cx: SafeJSContext, reason: SafeHandleValue) -> Rc<Promise> { | ||
| let promise = Promise::new(&self.reflector_.global()); | ||
| // step 1 | ||
| if self.stream.get().is_none() { |
There was a problem hiding this comment.
I think it would be clearer to invert the logic, by doing if let Some(stream) =, and doing step 1 in the else.
| return; | ||
| } | ||
|
|
||
| // <https://streams.spec.whatwg.org/#readable-stream-reader-generic-release> |
There was a problem hiding this comment.
let's put this in its own method, it is used in many other places in the spec, and also it's clearer with the spec link. We can do the same with other spec functions.
gterzian
left a comment
There was a problem hiding this comment.
Looks good, with some changes suggested.
| } | ||
| } | ||
|
|
||
| // Call into the release steps of the controller, |
| closed_promise: &Promise, | ||
| read_requests: DomRefCell<VecDeque<ReadRequest>>, | ||
| ) { | ||
| // step 2.1.3 |
There was a problem hiding this comment.
I think you can start counting from 1, since you are in the generic algo.
| self.set(None); | ||
|
|
||
| // step 3.1 | ||
| let error = Error::Type("No chunks are available because the stream is errored".to_owned()); |
There was a problem hiding this comment.
This can be moved to a method implementing https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreadererrorreadrequests on the reader. You can use the code at https://streams.spec.whatwg.org/#readable-stream-error and move it to a new method called in both places.
Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]>
86d5f18 to
9198d92
Compare
| } | ||
|
|
||
| /// <https://streams.spec.whatwg.org/#readable-stream-reader-generic-release> | ||
| pub fn release_lock(&self, closed_promise: &Promise) { |
There was a problem hiding this comment.
@gterzian this is ready again, please review it so we can move with next tasks
gterzian
left a comment
There was a problem hiding this comment.
Looks good, with a couple of points.
| .clone() | ||
| .to_jsval(*cx, &*self.global(), rval.handle_mut()) | ||
| }; | ||
| request.error_steps(rval.handle()); |
There was a problem hiding this comment.
since we only pass the handle, I think we can create the rval once outside of the loop.
| .expect("Reader must have read request when remove is called into.") | ||
| } | ||
|
|
||
| fn get_read_requests(&self) -> VecDeque<ReadRequest> { |
There was a problem hiding this comment.
I would say take_(...) is a clearer name for what the function does.
| fn Cancel(&self, _cx: SafeJSContext, reason: SafeHandleValue) -> Rc<Promise> { | ||
| let promise = Promise::new(&self.reflector_.global()); | ||
|
|
||
| if let Some(stream) = self.stream.get() { |
There was a problem hiding this comment.
For the assert below to make sense, and to follow the spec, we should:
- use
self.stream.get().is_none()here to conditionally reject the promise. - Add a method for
https://streams.spec.whatwg.org/#readable-stream-reader-generic-cancel - Do the assert inside that method(which I guess will be called from elsewhere later).
- Call the method outside of the conditional.
| closed_promise.reject_error(Error::Type("stream state is not readable".to_owned())); | ||
| } else { | ||
| // step 4 | ||
| closed_promise.reject_error(Error::Type( |
There was a problem hiding this comment.
Here we should create a new promise using new_rejected.
There was a problem hiding this comment.
indeed I missed this:
Otherwise, set reader.[[closedPromise]] to a promise rejected with a TypeError exception.
thanks
| // step 2.1.8 & 2.1.9 | ||
| match self.reader { | ||
| ReaderType::Default(ref reader) => { | ||
| reader.set(None); |
There was a problem hiding this comment.
We should first set the stream of the reader to None(to reflect the change to any JS still holding a ref to the reader).
| self.stream | ||
| .perform_pull_steps(ReadRequest::Read(promise.clone())); | ||
| if let Some(stream) = self.stream.get() { | ||
| stream.perform_pull_steps(ReadRequest::Read(promise.clone())); |
There was a problem hiding this comment.
This should call into https://streams.spec.whatwg.org/#readable-stream-default-reader-read (we don't have that method yet).
There was a problem hiding this comment.
I needed to changed this code because I converted stream to MutNullableDom<ReadableStream>, this read function is not implemented correctly, I think we can fix it in next PR when we add https://streams.spec.whatwg.org/#readable-stream-default-reader-read
| request.error_steps(rval.handle()); | ||
| } | ||
| } else { | ||
| // step 1 |
There was a problem hiding this comment.
I think we should also follow the spec more closely:
- add a conditional on
self.stream.get().is_none(). - Call into a new method for https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreaderrelease
- Move rest of algo to that new method(it can be called from other places later).
Signed-off-by: Taym <[email protected]>
| return; | ||
| } else { | ||
| // step 2 | ||
| self.release(); |
There was a problem hiding this comment.
@gterzian I tired to follow the spec more closely, please check again, thanks
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (servo#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (servo#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (servo#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (servo#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (servo#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (servo#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (servo#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (servo#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (servo#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (servo#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (servo#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (servo#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (servo#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (servo#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (servo#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]>
* Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (servo#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (servo#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (servo#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (servo#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (servo#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (servo#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (servo#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (servo#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (servo#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (servo#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (servo#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (servo#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (servo#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (servo#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (servo#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]>
--------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]>
…troller` (#34064) * Re-implement readablestream: basics and default reader and controller --------- Co-authored-by: Jason Tsai <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Add remaining WebIDLs of ReadableStream (#32605) * Add Reader's WebIDL files * Add necessary methods in ReadableStream.webidl Signed-off-by: Wu Wayne <[email protected]> Create safe wrapper for JSFunctions (#32620) * Create safe wrapper for JSFunctions Signed-off-by: Bentaimia Haddadi <[email protected]> * Add assert to check if the name ends in a null character Signed-off-by: Bentaimia Haddadi <[email protected]> * Create macro to wrap unsafe extern "C" function calls Signed-off-by: Bentaimia Haddadi <[email protected]> * Remove WRAPPER_FN Signed-off-by: Bentaimia Haddadi <[email protected]> * Add macro example documentation Signed-off-by: Bentaimia Haddadi <[email protected]> * Use C-string literals Signed-off-by: Bentaimia Haddadi <[email protected]> * Ensure name is Cstr type Signed-off-by: Bentaimia Haddadi <[email protected]> * Scope #[allow(unsafe_code)] Signed-off-by: Bentaimia Haddadi <[email protected]> --------- Signed-off-by: Bentaimia Haddadi <[email protected]> Signed-off-by: Wu Wayne <[email protected]> Start implementation of default controller and reader Start implementation of default controller and reader * implement basic internal slots, with todos Signed-off-by: gterzian <[email protected]> * enum for controller Signed-off-by: gterzian <[email protected]> * re-implement native controller methods Signed-off-by: gterzian <[email protected]> * add calling into pull algo Signed-off-by: gterzian <[email protected]> * more details on chunk enqueuing Signed-off-by: gterzian <[email protected]> * add fulfill read request, clean-up warnings Signed-off-by: gterzian <[email protected]> * read request and reader typing Signed-off-by: gterzian <[email protected]> * allow for more than one non-native underlying source type Signed-off-by: gterzian <[email protected]> * add todo for should pull Signed-off-by: gterzian <[email protected]> * add underlying source dom struct container Signed-off-by: gterzian <[email protected]> * remove rc around source type * add default controller init in stream constructor * setup source container with prototype of source dict * clean-up docs, dispatch of controller in pull algo call * turn off SM streams * remove prototype setting on underlying source container * fix read request promise resolving * tidy * clean-up js conversions in read req handlers * add queue with sizes concept * use dom in pull promise handlers * Demonstrate using dictionary as callback this object. * move value with size to a struct * fmt * put readable stream state in a cell * nits in expectations * remove allow unroot by passing read result directly to promise resolving * tidy * root default controller inside call_pull_if_needed --------- Signed-off-by: gterzian <[email protected]> Co-authored-by: Josh Matthews <[email protected]> Signed-off-by: Wu Wayne <[email protected]> ReadableStream: implement Cancel and Locked (#33136) * implement Locked * implement Cancel and close Signed-off-by: Wu Wayne <[email protected]> Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise Signed-off-by: Taym <[email protected]> mach fmt Signed-off-by: Taym <[email protected]> Readablestream default controller: get desired size (#33497) Signed-off-by: gterzian <[email protected]> stream: implement controller close (#33498) Signed-off-by: gterzian <[email protected]> implement stream default controller error (#33503) Signed-off-by: gterzian <[email protected]> Readablestream default controller: enqueue (#33528) * Implement ReadableStreamDefaultControllerMethods::Enqueue Signed-off-by: Wu Wayne <[email protected]> * Add spec comments Signed-off-by: Wu Wayne <[email protected]> --------- Signed-off-by: Wu Wayne <[email protected]> readablestream default controller: fulfill read requests (#33542) Signed-off-by: gterzian <[email protected]> Fix extract_size_algorithm (#33561) Signed-off-by: Wu Wayne <[email protected]> Readablestream default controller: use strategy size (#33551) * readablestream default controller: use strategy size, fallible enqueue Signed-off-by: gterzian <[email protected]> docs * readablestream default controller: clear strategy size Signed-off-by: gterzian <[email protected]> * prevent potential re-borrow panics when calling into the strategy size Signed-off-by: gterzian <[email protected]> * document readablestream constructor Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Readablestream: impl default controller should pull, start algo (#33586) * implement should-pull algo for default controller Signed-off-by: gterzian <[email protected]> * add start algorithm setup for default controller Signed-off-by: gterzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> implement promise native handling for start and pull algorithms (#33603) Signed-off-by: gterzian <[email protected]> Implement ReadableStreamDefaultReader (#33160) * Implement ReadableStreamDefaultReader Make the stream mutable readable-stream-reader-generic-release Proper error types when releasing Closed Cancel Signed-off-by: Taym <[email protected]> * follow the spec more closely Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Implement ReadableStreamDefaultReader read (#34007) * Implement ReadableStreamDefaultReader read Signed-off-by: Taym <[email protected]> * Perform readRequest’s error steps with stream.stored_error Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Improve ReadableStreamDefaultReader close (#34014) * improve ReadableStreamDefaultReader close Signed-off-by: Taym <[email protected]> * remove resolve_closed_promise Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> * Improve read_a_chunk and stop_reading implemntation (#34077) Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Implement ReadableStreamDefaultReader::Constructor (#34056) * Implement ReadableStreamDefaultReader::Constructor Signed-off-by: Taym <[email protected]> * make start_reading returns ReadableStreamDefaultReader Signed-off-by: Taym <[email protected]> * Fix can_gc Signed-off-by: Taym <[email protected]> * Add canGc to ReadableStream::GetReader Signed-off-by: Taym <[email protected]> --------- Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Readablestream fix CanGc (#34080) Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * correct ReadableStream::error_native implementation and fix clippy warnings (#34088) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * turn assertion of stream present on controller on a early return with false (#34097) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix already mutably borrowed crash (#34105) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Refactor `get_in_memory_bytes` to return `Option<Vec<u8>> and avoid `unreachable!` panic (#34123) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Set ReadableStream ReadableStreamDefaultReader in start_reading (#34125) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix Unhandled rejection with value: object `TypeError: stream is not locked` (#34204) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix assert!(self.is_readable()) crash in ReadableStream::close (#34207) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix call to to_js_object in underlying source algos (#34098) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * do not assume presence of a stream when performing pull steps (#34244) * do not assume presence of a stream when performing pull steps Signed-off-by: gterzian <[email protected]> * add doc comments Co-authored-by: Taym Haddadi <[email protected]> Signed-off-by: Gregory Terzian <[email protected]> --------- Signed-off-by: gterzian <[email protected]> Signed-off-by: Gregory Terzian <[email protected]> Co-authored-by: Taym Haddadi <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * gracefully handle failure of underlying source algorithms (#34243) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * ensure result of calling start algo is an object (#34245) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * return js failed error if underlying source constructor threw (#34246) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Use JSVal for ValueWithSize::value (#34259) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix release reader lock, (#34255) fix setting stream on controller in new, fix matching fallthrough, reduce visibility of controller error method Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * in stream cancel, reject promist if locked (#34271) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix UnderlyingSourceContainer::call_start_algorithm (#34277) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * implement controller cancel steps, fix stream cancel method (#34301) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix conditional in perform pull steps (#34324) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * set reader closed promise to one resolved with undefined if stream closed on init (#34321) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix init of stream and controller (#34323) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Stream: Fix reborrow in controller enqueue, and fix error and exception handling. (#34338) * fix re-borrow in controller enqueue Signed-off-by: gterzian <[email protected]> * do not call to_jsval on JSFailed error in enqueue Signed-off-by: gterzian <[email protected]> * fix error and exception handling in controller enqueue Signed-off-by: gterzian <[email protected]> * remove TODO about correctness of stored error, since this was done as part of the switch to a js val. 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]> * Stream: Fix incorrect "this" object in underlying source callbacks (#34368) * in controller close, throw type error if stream cannot be closed Signed-off-by: gterzian <[email protected]> * store original js object for underlying source, for use as this object in callbacks 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]> * fix conditional logic in enqueue to ensure pull is called into (#34375) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Stream: Fix bytelength queueing strategy (#34376) * fix handling of value that is not an object in bytelength queuing strategy Signed-off-by: gterzian <[email protected]> * return type error if strategy size call fails, to prevent panic because no exception is pending 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]> * set correct default count queuing size strategy (#34389) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * use proto in stream constructor (#34441) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix edge cases in get_desired_size (#34440) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Stream: fix algo and strategy calls error handling. (#34424) * 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]> * fix native use of streams (#34468) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Implement readablestreamdefaulttee (#34405) * 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]> * Align ReadableStreamDefaultReader with spec and fix additional tests 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]> * Streams: fetch stream chunks should be uint8 arrays (#34553) * 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]> * Update wpt test for ReadableStream reimplementation (#34579) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix ignore_malloc_size_of in readablestream tee (#34578) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Remove incorrect use of handle array, fail test safely by giving only one reason (#34560) Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Update more wpt test for ReadableStream reimplementation (#34598) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Fix doc and rename Tee to DefaultTee (#34612) Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * fix: Address review comments Signed-off-by: Taym <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> * Update response-stream-with-broken-then.any.js.ini test expectation Signed-off-by: Taym Haddadi <[email protected]> * fix reflect_dom_object can_gc Signed-off-by: Taym Haddadi <[email protected]> * Fix compositeReason for DefaultTeeUnderlyingSource (#34627) * 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]> * Last fixes stream (#34636) * 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]> * fix crown rooting related errors (#34662) Signed-off-by: Gregory Terzian <[email protected]> --------- Signed-off-by: Taym <[email protected]> Signed-off-by: gterzian <[email protected]> Signed-off-by: Taym Haddadi <[email protected]> Signed-off-by: Gregory Terzian <[email protected]> Co-authored-by: Wu Wayne <[email protected]> Co-authored-by: Taym Haddadi <[email protected]>
Part of #32898
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors