From bcad0d50e96cc9ffe190d0bbe2519df1bcadcfd3 Mon Sep 17 00:00:00 2001 From: Taym Haddadi Date: Sun, 5 Jan 2025 12:37:15 +0100 Subject: ReadableStream: remove the use of get_js_stream and use DomRoot (#34836) * Remove the use of get_js_stream and use DomRoot Signed-off-by: Taym Haddadi * return an error instead of Option Signed-off-by: Taym Haddadi --------- Signed-off-by: Taym Haddadi --- components/script/dom/blob.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'components/script/dom/blob.rs') 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 { } /// - pub fn get_stream(&self, can_gc: CanGc) -> DomRoot { + pub fn get_stream(&self, can_gc: CanGc) -> Fallible> { self.global().get_blob_stream(&self.blob_id, can_gc) } } @@ -226,8 +224,8 @@ impl BlobMethods for Blob { } // - fn Stream(&self, _cx: JSContext, can_gc: CanGc) -> NonNull { - self.get_stream(can_gc).get_js_stream() + fn Stream(&self, can_gc: CanGc) -> Fallible> { + self.get_stream(can_gc) } // https://w3c.github.io/FileAPI/#slice-method-algo -- cgit v1.2.3