Skip to content

structuredClone coerces rejected values while creating DataCloneError #58220

Description

@OskarEichler

Description

The React Native structuredClone polyfill interpolates rejected values into its error message. That invokes user-defined coercion such as Symbol.toPrimitive; a non-cloneable function or WeakMap can therefore replace the required DataCloneError with an arbitrary user-thrown error.

Expected behavior

Rejecting an unsupported value should produce DOMException / DataCloneError without executing user coercion hooks. The non-standard message does not need to include the rejected value.

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