Skip to content

Add a structuredClone() global - #518

Open
dan-distributive wants to merge 2 commits into
mainfrom
feature/structured-clone
Open

dan-distributive wants to merge 2 commits into
mainfrom
feature/structured-clone

Conversation

@dan-distributive

Copy link
Copy Markdown
Contributor

Adds structuredClone() as a global, using core-js's polyfill, the same way url.js and dom-exception.js provide URL and DOMException.

dcp-client's supervisor calls structuredClone() (origin access templates, error shapes). Without it, localExec() under PythonMonkey stops at the supervisor (dcp MR !3327).

  • builtin_modules/structured-clone.js, loaded at import next to url
  • global.d.ts declaration
  • tests/js/structured-clone.simple: arrays, Map, Date, Uint8Array, cycles, and DataCloneError for functions

Tested with pmjs on macOS arm64 against an installed 1.4.1 with the module overlaid; url.simple, test-atob-btoa.simple and set-timeout.simple still pass.

🤖 Generated with Claude Code

dcp-client's supervisor clones its origin-access templates and error shapes
with structuredClone(), which SpiderMonkey's shell globals don't provide, so
localExec() under PythonMonkey stops there. Use core-js's polyfill, as url.js
and dom-exception.js already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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