mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Script: implement ReadableStreamBYOBReader::Read
(#35040)
* Script: implement ReadableStreamBYOBReader::Read Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix ReadRequest::close_steps Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * implement viewed_buffer_array_byte_length and byte_length Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Correct BufferSource implemntation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Correct detach_buffer implemantation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix JS_IsArrayBufferViewObject usage Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Reduce BufferSource to two variants ArrayBuffer and ArrayBufferView Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Add more doc and use promise.reject_error Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
parent
177b5b2cef
commit
9943e97726
7 changed files with 406 additions and 224 deletions
|
@ -4,13 +4,18 @@
|
|||
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleValue as SafeHandleValue;
|
||||
use js::typedarray::ArrayBufferViewU8;
|
||||
|
||||
use super::bindings::buffer_source::HeapBufferSource;
|
||||
use super::bindings::codegen::Bindings::ReadableStreamBYOBReaderBinding::ReadableStreamBYOBReaderReadOptions;
|
||||
use super::readablestreambyobreader::ReadIntoRequest;
|
||||
use super::types::ReadableStreamBYOBRequest;
|
||||
use crate::dom::bindings::codegen::Bindings::ReadableByteStreamControllerBinding::ReadableByteStreamControllerMethods;
|
||||
use crate::dom::bindings::import::module::{Error, Fallible};
|
||||
use crate::dom::bindings::reflector::Reflector;
|
||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||
use crate::dom::readablestream::ReadableStream;
|
||||
use crate::script_runtime::JSContext as SafeJSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||
|
||||
/// <https://streams.spec.whatwg.org/#readablebytestreamcontroller>
|
||||
#[dom_struct]
|
||||
|
@ -23,14 +28,22 @@ impl ReadableByteStreamController {
|
|||
pub(crate) fn set_stream(&self, stream: &ReadableStream) {
|
||||
self.stream.set(Some(stream))
|
||||
}
|
||||
|
||||
/// <https://streams.spec.whatwg.org/#readable-byte-stream-controller-pull-into>
|
||||
pub(crate) fn perform_pull_into(
|
||||
&self,
|
||||
_read_into_request: &ReadIntoRequest,
|
||||
_view: HeapBufferSource<ArrayBufferViewU8>,
|
||||
_options: &ReadableStreamBYOBReaderReadOptions,
|
||||
_can_gc: CanGc,
|
||||
) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadableByteStreamControllerMethods<crate::DomTypeHolder> for ReadableByteStreamController {
|
||||
/// <https://streams.spec.whatwg.org/#rbs-controller-byob-request>
|
||||
fn GetByobRequest(
|
||||
&self,
|
||||
) -> Fallible<Option<DomRoot<super::readablestreambyobrequest::ReadableStreamBYOBRequest>>>
|
||||
{
|
||||
fn GetByobRequest(&self) -> Fallible<Option<DomRoot<ReadableStreamBYOBRequest>>> {
|
||||
// TODO
|
||||
Err(Error::NotFound)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue