Skip to content

structuredClone invokes custom Map and Set iterators #58222

Description

@OskarEichler

Description

The React Native structuredClone polyfill traverses Map and Set values with for...of. An own Symbol.iterator override is therefore executed and can change the cloned contents or abort cloning, even though structured cloning should read the built-in collection data from internal slots.

Expected behavior

Map and Set cloning should ignore user iterator overrides and clone their real built-in entries, matching native structuredClone.

React Native Version

0.87.1 and current main

Affected Platforms

JavaScript runtime - All

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions