diff options
author | Taym Haddadi <haddadi.taym@gmail.com> | 2025-01-05 12:37:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-05 11:37:15 +0000 |
commit | bcad0d50e96cc9ffe190d0bbe2519df1bcadcfd3 (patch) | |
tree | 6c9564a14488e25338edbc7e847b92688bd570d6 /components/script/dom/blob.rs | |
parent | 15eb405f36bc714a8644fb0b1e4a502ebaa7d76e (diff) | |
download | servo-bcad0d50e96cc9ffe190d0bbe2519df1bcadcfd3.tar.gz servo-bcad0d50e96cc9ffe190d0bbe2519df1bcadcfd3.zip |
ReadableStream: remove the use of get_js_stream and use DomRoot<ReadableStream> (#34836)
* Remove the use of get_js_stream and use DomRoot<ReadableStream>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* return an error instead of Option
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r-- | components/script/dom/blob.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 07b542da9b3..5ab139f3528 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -4,13 +4,11 @@ use std::collections::HashMap; use std::num::NonZeroU32; -use std::ptr::NonNull; use std::rc::Rc; use base::id::{BlobId, BlobIndex, PipelineNamespaceId}; use dom_struct::dom_struct; use encoding_rs::UTF_8; -use js::jsapi::JSObject; use js::rust::HandleObject; use net_traits::filemanager_thread::RelativePos; use script_traits::serializable::BlobImpl; @@ -30,7 +28,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::readablestream::ReadableStream; use crate::realms::{AlreadyInRealm, InRealm}; -use crate::script_runtime::{CanGc, JSContext}; +use crate::script_runtime::CanGc; // https://w3c.github.io/FileAPI/#blob #[dom_struct] @@ -86,7 +84,7 @@ impl Blob { } /// <https://w3c.github.io/FileAPI/#blob-get-stream> - pub fn get_stream(&self, can_gc: CanGc) -> DomRoot<ReadableStream> { + pub fn get_stream(&self, can_gc: CanGc) -> Fallible<DomRoot<ReadableStream>> { self.global().get_blob_stream(&self.blob_id, can_gc) } } @@ -226,8 +224,8 @@ impl BlobMethods<crate::DomTypeHolder> for Blob { } // <https://w3c.github.io/FileAPI/#blob-get-stream> - fn Stream(&self, _cx: JSContext, can_gc: CanGc) -> NonNull<JSObject> { - self.get_stream(can_gc).get_js_stream() + fn Stream(&self, can_gc: CanGc) -> Fallible<DomRoot<ReadableStream>> { + self.get_stream(can_gc) } // https://w3c.github.io/FileAPI/#slice-method-algo |