Skip to content

[codex] fix Node Web Storage globals#4341

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-web-storage-globals
Jun 4, 2026
Merged

[codex] fix Node Web Storage globals#4341
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-web-storage-globals

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

Fixes #812.

  • Return the rooted localStorage and sessionStorage objects from the reflected global descriptor getters instead of undefined.
  • Give Storage.prototype.length its own receiver-aware getter so it keeps the existing illegal-invocation behavior.
  • Allow internal storage mutations to refresh the readonly length data slot by clearing and restoring attrs around the update.
  • Extend globals/storage-globals with descriptor getter coverage.

Root Cause

The Web Storage globals installed reflectable accessor descriptors, but the shared getter stub always returned undefined. After exposing the actual storage objects through the descriptor getters, storage mutations also hit an existing internal update path that wrote to the readonly length property through normal property assignment and threw.

Known Limit

This keeps the existing in-memory/process-local Web Storage behavior. It does not change persistence or flag handling.

Validation

  • npm exec --package=node@26 -- node --experimental-webstorage --localstorage-file=/tmp/perry_web_storage_parity.sqlite test-parity/node-suite/globals/storage-globals.ts
  • Manual Perry compile/run for globals/storage-globals, then diff -u /tmp/perry_storage_node.out /tmp/perry_storage_run.out clean
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/node-web-storage-globals npm exec --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module globals --filter storage-globals' -> pass, report test-parity/reports/parity_report_20260604_040722.json
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/node-web-storage-globals cargo check -p perry-runtime
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

@proggeramlug proggeramlug marked this pull request as ready for review June 4, 2026 10:09
@proggeramlug proggeramlug merged commit 664f4e1 into PerryTS:main Jun 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compat: wire the 42-module parity matrix into CI with per-module trend

2 participants