Use bounded native SHA256 inside digest Workers

This commit is contained in:
2026-11-09 20:16:39 +08:00
parent fea813ac4f
commit 70bc134436
5 changed files with 52 additions and 2 deletions
+10
View File
@@ -490,3 +490,13 @@ again after each real task yield. Byte/ordinal cursors, parser versions and sour
fingerprints are unchanged. This is a soft budget: a bounded JSON decode is
indivisible. Legacy and out-of-order document headers retain indexed preparation;
canonical parser 5 headers allow progressive payload scanning.
The dedicated digest Worker uses native `crypto.subtle.digest('SHA-256', ...)`
for inputs up to 64 MiB. The browser pool admits two active Workers, each reading at most
64 MiB on this path. This bounds admitted input per Worker, not total browser
memory or native cleanup timing. Larger inputs or a missing native capability keep the 1 MiB
streaming SHA implementation. Main-thread fallback stays chunked/cooperative.
Native read/hash errors remain visible; they do not silently select another path.
Worker termination still owns cancellation. The full source check remains before
imported elements are published; no journal revisions or integrity gates are skipped.