Skip to content

fix(runtime): align Web Storage accessors#4343

Closed
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-storage-globals
Closed

fix(runtime): align Web Storage accessors#4343
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-storage-globals

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 4, 2026

Summary

  • Make the localStorage and sessionStorage accessor getters return their canonical storage objects instead of undefined.
  • Split the Storage.prototype.length getter from the global storage getter so it returns the current storage length for storage receivers and throws Illegal invocation for incompatible receivers.
  • Extend the globals/storage-globals parity fixture to cover storage getter identity and Storage.prototype.length invocation behavior.

Root Cause

The runtime installed reflectable Web Storage accessor descriptors, but reused a no-op getter thunk. Descriptor getter calls therefore returned undefined, and the prototype length getter did not enforce Node's receiver behavior.

Validation

  • NODE26_BIN=$(npm exec --yes --package=node@26 -- node -e 'console.log(process.execPath)') && "$NODE26_BIN" --experimental-strip-types --experimental-webstorage --localstorage-file=/tmp/perry_web_storage_parity.sqlite test-parity/node-suite/globals/storage-globals.ts
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/storage-globals-check RUSTC_WRAPPER= CARGO_BUILD_JOBS=1 cargo check -q -j1 -p perry-runtime
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

Refs #812.

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Closing this duplicate in favor of #4341, which covers the same Web Storage accessor slice and has the fuller internal length-slot fix plus focused parity validation.

@andrewtdiz andrewtdiz closed this Jun 4, 2026
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.

1 participant