Parent: #473 Depends on audit split: #678 Related: #666, #676
Problem
After the construction/state layer in #678, seven RegExp/String protocol coercions still expose physical bytes from toStringV to canonical scanners or output builders:
- flags in
RegExp.prototype[@@matchAll]; - flags in
RegExp.prototype[@@match]; - the replacement template and flags in
RegExp.prototype[@@replace]; - flags in
RegExp.prototype[@@split]; - RegExp flags checks in
String.prototype.replaceAllandString.prototype.matchAll.
With physical flat Latin-1 storage active, a replacement template can copy invalid canonical bytes into output, and custom flags StringData can be passed through canonical String construction or protocol scanners in physical form.
Scope
- Route these seven protocol coercions through the representation-aware WTF-8 helper.
- Preserve exact Get/ToString order and count, global/unicode/sticky flag checks, species construction, lastIndex reads/writes, zero-length advancement, replacement-token semantics, functional replacer behavior, split limits/captures, dispatch ordering, exception identity, ASCII borrowing, and OOM propagation.
- Cover custom non-ASCII replacement text and custom flags objects under canonical and physical flat-Latin-1 storage.
No-workaround rules
- No flat-storage disablement, eager global canonicalization, replacement characters, duplicate coercion, alternate regex engine, hidden retry, Test262 exclusion, or changed protocol dispatch.
- No stack, queue, job, Promise, Worker, or Map/Set iterator changes.
- Construction, compile, toString, and legacy state remain owned by #678.
Acceptance
- Every affected protocol byte scanner/output builder consumes canonical semantic WTF-8.
- Custom flags and replacement hooks run exactly once and in specification order.
- Non-ASCII replacement templates preserve exact output under global and non-global replacement.
- The witness passes with canonical storage and with
flat_storage_activeenabled, then the switch is restored and not landed. - Relevant nonzero RegExp/String Test262 accounting, focused Debug/ReleaseSafe/TSan, and full units pass with exact flips reported.