Problem
String exotic [[GetOwnProperty]] descriptor paths used backing-byte length and one-byte slices for length and indexed character properties. Canonical WTF-8 therefore reported byte counts for non-ASCII strings and could create invalid character backing when a descriptor indexed a multibyte BMP value, astral pair, or lone surrogate. Flat Latin-1 has a different one-byte-per-code-unit storage contract, so the fix is representation-aware rather than routing every access through an unbounded full-string transcode.
The ordinary [[Get]], own-key, has-own, and set paths already used UTF-16 length/index helpers; reflective descriptors and primitive-string CopyDataProperties diverged from them. Existing upstream coverage is ASCII-only at this boundary.
Scope
- Make String exotic
lengthand indexed descriptors use UTF-16 code-unit semantics for primitive and boxed strings. - Return exact BMP values and canonical lone surrogate units when an astral scalar is indexed.
- Reuse the same representation-aware index helper in ordinary property access and primitive-string CopyDataProperties.
- Keep ASCII and flat Latin-1 indexing O(1); do not transcode an entire flat string to read one unit.
- Cover compatible redefinition of immutable index descriptors without weakening their attributes.
No-workaround rules
- No byte slicing, replacement characters, code-point indexing, upstream exclusions, or full-string transcoding for flat Latin-1 index access.
- No stacks, queues, jobs, Promise, Worker, or Map/Set iterator changes.
Acceptance
- Primitive and boxed string descriptors expose exact UTF-16 length, values, and immutable attributes for ASCII, BMP, astral, and lone-surrogate inputs.
- Compatible index redefinition succeeds and incompatible redefinition remains rejected.
- Object spread/rest over primitive strings copies the same UTF-16 code-unit properties as String exotic reflection.
- Focused String/Object units, relevant nonzero Test262 accounting, and the full unit gate pass with zero regressions.