aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/blob.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-01-10 03:19:19 -0500
committerGitHub <noreply@github.com>2025-01-10 08:19:19 +0000
commitc94d909a8688589209cdf0c7ae58e40f9b8c411e (patch)
tree12febf23eed4438249fd4d276c4d8b35dee22a97 /components/script/dom/blob.rs
parentf220d6d3a52296794cd19935e9e59cc75a179a44 (diff)
downloadservo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.tar.gz
servo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.zip
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r--components/script/dom/blob.rs18
1 files changed, 9 insertions, 9 deletions
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<Blob> {
+ pub(crate) fn new(global: &GlobalScope, blob_impl: BlobImpl, can_gc: CanGc) -> DomRoot<Blob> {
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<Vec<u8>, ()> {
+ pub(crate) fn get_bytes(&self) -> Result<Vec<u8>, ()> {
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)
}
/// <https://w3c.github.io/FileAPI/#blob-get-stream>
- pub fn get_stream(&self, can_gc: CanGc) -> Fallible<DomRoot<ReadableStream>> {
+ pub(crate) fn get_stream(&self, can_gc: CanGc) -> Fallible<DomRoot<ReadableStream>> {
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
/// <https://w3c.github.io/FileAPI/#constructorBlob>
#[allow(unsafe_code)]
-pub fn blob_parts_to_bytes(
+pub(crate) fn blob_parts_to_bytes(
mut blobparts: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>,
) -> Result<Vec<u8>, ()> {
let mut ret = vec![];
@@ -302,7 +302,7 @@ impl BlobMethods<crate::DomTypeHolder> for Blob {
/// XXX: We will relax the restriction here,
/// since the spec has some problem over this part.
/// see <https://github.com/w3c/FileAPI/issues/43>
-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<Mime, ()> {