Skip to content

Ignore RegExp property overrides when cloning - #58225

Open
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-structured-clone-regexp-overrides
Open

Ignore RegExp property overrides when cloning#58225
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-structured-clone-regexp-overrides

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary:

The structured-clone polyfill reads user-visible RegExp source/flags, allowing own overrides to replace internal state. Capture and call the built-in source and individual flag getters, feature-detecting d/v, and construct canonical dgimsuvy flags directly from internal slots.

Fixes #58224.

Changelog:

[GENERAL] [FIXED] - Clone RegExp internal source and flags without using property overrides.

Test Plan:

  • Exact Hermes baseline cloned internal /foo/g with shadowed properties as /bar/.
  • Final regression shadows source, aggregate flags, and every individual flag property with conflicting values; the clone remains /foo/g.
  • Fixed focused Fantom suite: 32/32 passed, matching native structuredClone.
  • Fresh yarn flow-check: 0 errors.
  • Targeted ESLint, Prettier, and git diff --check passed.

Root review caught that the first draft's captured aggregate flags getter still read per-flag overrides; the final head uses the individual intrinsics. No UI change; screenshots are not applicable.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

structuredClone reads user-overridden RegExp properties

1 participant