From c94d909a8688589209cdf0c7ae58e40f9b8c411e Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 10 Jan 2025 03:19:19 -0500 Subject: script: Limit public exports. (#34915) * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews * Formatting. Signed-off-by: Josh Matthews * Fix clippy warnings. Signed-off-by: Josh Matthews * Formatting. Signed-off-by: Josh Matthews * Fix unit tests. Signed-off-by: Josh Matthews * Fix clippy. Signed-off-by: Josh Matthews * More formatting. Signed-off-by: Josh Matthews --------- Signed-off-by: Josh Matthews --- components/script/dom/blob.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'components/script/dom/blob.rs') diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 5ab139f3528..d57772a523b 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -32,14 +32,14 @@ use crate::script_runtime::CanGc; // https://w3c.github.io/FileAPI/#blob #[dom_struct] -pub struct Blob { +pub(crate) struct Blob { reflector_: Reflector, #[no_trace] blob_id: BlobId, } impl Blob { - pub fn new(global: &GlobalScope, blob_impl: BlobImpl, can_gc: CanGc) -> DomRoot { + pub(crate) fn new(global: &GlobalScope, blob_impl: BlobImpl, can_gc: CanGc) -> DomRoot { Self::new_with_proto(global, None, blob_impl, can_gc) } @@ -60,7 +60,7 @@ impl Blob { } #[allow(crown::unrooted_must_root)] - pub fn new_inherited(blob_impl: &BlobImpl) -> Blob { + pub(crate) fn new_inherited(blob_impl: &BlobImpl) -> Blob { Blob { reflector_: Reflector::new(), blob_id: blob_impl.blob_id(), @@ -68,23 +68,23 @@ impl Blob { } /// Get a slice to inner data, this might incur synchronous read and caching - pub fn get_bytes(&self) -> Result, ()> { + pub(crate) fn get_bytes(&self) -> Result, ()> { self.global().get_blob_bytes(&self.blob_id) } /// Get a copy of the type_string - pub fn type_string(&self) -> String { + pub(crate) fn type_string(&self) -> String { self.global().get_blob_type_string(&self.blob_id) } /// Get a FileID representing the Blob content, /// used by URL.createObjectURL - pub fn get_blob_url_id(&self) -> Uuid { + pub(crate) fn get_blob_url_id(&self) -> Uuid { self.global().get_blob_url_id(&self.blob_id) } /// - pub fn get_stream(&self, can_gc: CanGc) -> Fallible> { + pub(crate) fn get_stream(&self, can_gc: CanGc) -> Fallible> { self.global().get_blob_stream(&self.blob_id, can_gc) } } @@ -162,7 +162,7 @@ impl Serializable for Blob { /// Extract bytes from BlobParts, used by Blob and File constructor /// #[allow(unsafe_code)] -pub fn blob_parts_to_bytes( +pub(crate) fn blob_parts_to_bytes( mut blobparts: Vec, ) -> Result, ()> { let mut ret = vec![]; @@ -302,7 +302,7 @@ impl BlobMethods for Blob { /// XXX: We will relax the restriction here, /// since the spec has some problem over this part. /// see -pub fn normalize_type_string(s: &str) -> String { +pub(crate) fn normalize_type_string(s: &str) -> String { if is_ascii_printable(s) { s.to_ascii_lowercase() // match s_lower.parse() as Result { -- cgit v1.2.3