WebIDL impl: remove unsafe JSObject when returning a ReadableStream
Part of https://github.com/servo/servo/issues/30862
Same as https://github.com/servo/servo/issues/30889
Depends on https://github.com/servo/servo/pull/29881
All the below should return a concrete, and safe, ReadableStream object.
https://github.com/servo/servo/blob/8bbcf0abafc22cd840cd03f36b5b3b7d2d815493/components/script/dom/blob.rs#L234
https://github.com/servo/servo/blob/8bbcf0abafc22cd840cd03f36b5b3b7d2d815493/components/script/dom/request.rs#L603
https://github.com/servo/servo/blob/8bbcf0abafc22cd840cd03f36b5b3b7d2d815493/components/script/dom/response.rs#L360
@servo-highfive assign me
Hey @SummerGram! Thanks for your interest in working on this issue. It's now assigned to you!
@SummerGram Thank you for your interest! This one is complicated and there is already a WIP at https://github.com/servo/servo/pull/29881
I can help you find one that would match your current skillset better. I've messaged you in the relevant topic on zullip...
For this, we need to implement:
Which would replace what is currently done via the js stream.
Note that the underlying source can be both one coming from the JS side of things, or a native one. We already have the native one via ExternalUnderlyingSourceController, which we can keep in some way, and remove the bindings to spidermonkey, since in this implementation the Rust would call into the native controller directly. So we need to essentially implement the JS part, via the WebIDL(we already have the "private" native one).
Besides the above, we also need to implement part of the public WebIDL, which currently is non-existent because managed by spidermonkey. Only a part of the interface is required, I believe SM did not do any of the writable stream stuff. So that means:
- the constructor
- locked
- cancel
- getReader
- tee(?)
- So skipping the piping part, which seems to require writeable streams.
We also need to implement the reader, note that are two variants(again not sure if SM implemented all). This would replace what is currently done with js reader.
There are some other trivial WebIDL objects we need to implement as well to support the rest.