diff --git a/mordant-baseline.toml b/mordant-baseline.toml index ffb2cdcf58b1..adefb526d4d7 100644 --- a/mordant-baseline.toml +++ b/mordant-baseline.toml @@ -27,7 +27,6 @@ [bun_jsc] "bare_bool_args:src/jsc/ZigStackFrame.rs" = 1 "defaulted_failure:src/jsc/ConsoleObject.rs" = 4 -"reimplemented_helper:src/jsc/webcore_types.rs" = 1 "same_match_twice:src/jsc/VirtualMachine.rs" = 1 [bun_parsers] diff --git a/src/jsc/webcore_types.rs b/src/jsc/webcore_types.rs index b3a6a52daae4..fa74140c563b 100644 --- a/src/jsc/webcore_types.rs +++ b/src/jsc/webcore_types.rs @@ -415,20 +415,15 @@ impl Blob { } } - /// `Blob.isBunFile()` — backed by a filesystem `Store::File`. - #[inline] - pub fn is_bun_file(&self) -> bool { - matches!(self.store.get().as_deref(), Some(s) if matches!(s.data, store::Data::File(_))) - } - /// `Blob.isS3()` — backed by an S3 `Store::S3`. #[inline] pub fn is_s3(&self) -> bool { matches!(self.store.get().as_deref(), Some(s) if matches!(s.data, store::Data::S3(_))) } - /// `Blob.needsToReadFile()` — true when bytes must be fetched off-disk - /// before any in-memory consumer can see them (i.e. `Store::File`). + /// `Blob.needsToReadFile()` — backed by a filesystem `Store::File` (a + /// `Bun.file()`), so the bytes must be fetched off-disk before any + /// in-memory consumer can see them. #[inline] pub fn needs_to_read_file(&self) -> bool { matches!(self.store.get().as_deref(), Some(s) if matches!(s.data, store::Data::File(_))) diff --git a/src/runtime/crypto/CryptoHasher.rs b/src/runtime/crypto/CryptoHasher.rs index eef63fc555bb..f2e0f2bc02f4 100644 --- a/src/runtime/crypto/CryptoHasher.rs +++ b/src/runtime/crypto/CryptoHasher.rs @@ -40,11 +40,11 @@ fn boring_engine(global: &JSGlobalObject) -> *mut boring_ssl::ENGINE { .cast::() } -/// Local helper replacing `input == .blob && input.blob.isBunFile()`. +/// The synchronous hashers only accept in-memory input, not a `Bun.file()`. #[inline] fn is_bun_file_blob(input: &BlobOrStringOrBuffer) -> bool { match input { - BlobOrStringOrBuffer::Blob(b) => b.is_bun_file(), + BlobOrStringOrBuffer::Blob(b) => b.needs_to_read_file(), _ => false, } } diff --git a/src/runtime/webcore/Blob.rs b/src/runtime/webcore/Blob.rs index 87d303166b86..fec428626363 100644 --- a/src/runtime/webcore/Blob.rs +++ b/src/runtime/webcore/Blob.rs @@ -136,13 +136,9 @@ pub use bun_jsc::generated::JSBlob as js; // ────────────────────────────────────────────────────────────────────────── -// is_s3: defined once above (near is_bun_file); duplicate removed to fix E0034. - // is_all_ascii: canonical impl lives later in this file (pub). Duplicate // private helper removed here to fix E0592. -// needs_to_read_file: defined once above; duplicate removed to fix E0034. - // ────────────────────────────────────────────────────────────────────────── // BlobExt — `bun_runtime`-tier behaviour layered on the `bun_jsc` data type. // Inherent methods (`new`/`init`/`shared_view`/`dupe`/`detach`/`deinit`/…) @@ -153,9 +149,9 @@ pub use bun_jsc::generated::JSBlob as js; #[allow(non_snake_case, clippy::too_many_arguments)] pub trait BlobExt { fn get_form_data_encoding(&self) -> Option>; - // `has_content_type_from_user`/`content_type_or_mime_type`/`is_bun_file`/ - // `is_s3`/`needs_to_read_file`/`get_file_name`: data-only predicates, - // hoisted to inherent `impl Blob` in `bun_jsc::webcore_types` (LAYERING). + // `has_content_type_from_user`/`content_type_or_mime_type`/`is_s3`/ + // `needs_to_read_file`/`get_file_name`: data-only predicates, hoisted to + // inherent `impl Blob` in `bun_jsc::webcore_types` (LAYERING). fn do_read_from_s3( &self, global: &JSGlobalObject, diff --git a/src/runtime/webcore/Response.rs b/src/runtime/webcore/Response.rs index c80be4ab57f6..72f171585728 100644 --- a/src/runtime/webcore/Response.rs +++ b/src/runtime/webcore/Response.rs @@ -606,7 +606,7 @@ mod _jsc_host_fns { match body { BodyValue::Used | BodyValue::Empty | BodyValue::Null => JSValue::UNDEFINED, BodyValue::Blob(blob) => { - if blob.is_bun_file() { + if blob.needs_to_read_file() { return JSValue::UNDEFINED; } let result =