ReviewOS

zig-utils/zig-js

FormData: canonicalize stored entry-name StringData reads

#688
Closed chris opened this 9 days ago ·
9 days ago

Parent: #473

Problem

FormData correctly converts entry names to USVString and stores them as string Values. Its shared fdPair reader later exposes the physical asStr byte image. With flat Latin-1 storage, lookup/mutation equality, forEach/iterator keys, private entry access, and application/x-www-form-urlencoded serialization can therefore disagree with the original JavaScript name.

Scope

  • Make the shared FormData pair reader return canonical WTF-8 for stored name Values.
  • Route append/set/get/getAll/has/delete, iteration/forEach, private entry reads, and serialization through that fallible representation-aware reader.
  • Preserve USVString conversion, insertion order, duplicate replacement, File values, callback ordering, and exact coercion count.
  • Keep the separate private C API File filename boundary out of this child.

This issue does not touch promises, jobs, queues, workers/threads, or Map/Set iterators.

Acceptance

  • Latin-1 names round-trip through all FormData lookup/mutation and iteration surfaces.
  • URL-encoded serialization uses the exact UTF-8 name bytes.
  • Object-valued name arguments coerce exactly once per public call.
  • Canonical and forced-flat storage witnesses pass in Debug, ReleaseSafe, and TSan.
  • Full sharded units report zero failures and zero leaks.
  • Test262 Web API coverage is inventoried explicitly; a zero denominator is reported as no corpus claim.
9 days ago

Implemented and pushed in https://github.com/zig-utils/zig-js/commit/d162963bf477d9375c59bd7c1e857dccf9fbfbc2.

The shared FormData pair reader now exposes stored entry names as representation-aware WTF-8. Lookup/mutation equality, forEach and iterators, private entry access, and URL-encoded serialization all consume that canonical result while preserving USVString ingress and coercion order.

Validation: focused Debug, forced-flat storage, ReleaseSafe, and TSan 1/1 each; full units 1781 passed, 1 skipped, 0 failed, 0 leaked. Test262 contains 0 FormData Web API files, so no corpus conformance claim is made.

Sign in to comment on this issue.