Commit 32aa095
A strict-mode `obj[sym] = v` where `sym` is a Symbol routes through
`js_put_value_set` → `ordinary_set_with_receiver` → `own_set_descriptor`.
For a symbol key that helper returned `Data { writable: true }`
unconditionally whenever the property existed, ignoring the receiver's frozen
state and any per-symbol `writable:false` attribute. So `Object.freeze(obj);
obj[sym] = 2` silently no-op'd instead of throwing the required TypeError
(test262 Object/freeze/frozen-object-contains-symbol-properties-strict) — the
string-keyed path already reported these correctly.
Fix: `own_set_descriptor` now reports a symbol-keyed data property's real
writability via a new `symbol::symbol_property_is_non_writable` query, which
mirrors the frozen / per-symbol-attr rejection already in
`set_symbol_property` (frozen receiver ⇒ non-writable; else consult the
per-symbol attrs table). `ordinary_set_with_receiver` then returns false and
`js_put_value_set` throws under strict mode.
test262 built-ins/Object/freeze: slice now 0 fail. Verified against Node:
normal symbol overwrite, a `defineProperty(obj, sym, {writable:false})` strict
write (throws), a sealed-but-not-frozen object's existing symbol (still
writable), and `Symbol.iterator` all behave correctly.
Refs #5901.
Co-authored-by: Ralph Küpper <ralph@skelpo.com>
1 parent 1839711 commit 32aa095
3 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
903 | | - | |
904 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
905 | 913 | | |
906 | 914 | | |
907 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
368 | 395 | | |
369 | 396 | | |
370 | 397 | | |
| |||
0 commit comments