Skip to content

structuredClone coerces rejected values while creating DataCloneError #58220

Open

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

Activity

  1. react-native-bot commented on Aug 30, 2026

    @react-native-bot
    Collaborator

    Warning

    Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


    You can read more about about it on our website: How to report a bug.

  2. react-native-bot commented on Sep 24, 2026

    @react-native-bot
    Collaborator

    This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

  3. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    and removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Sep 24, 2026
  4. OskarEichler commented on Oct 2, 2026

    @OskarEichler
    ContributorAuthor

    Added the requested runnable RNTester Playground in #58806. Open Playground and press Run reproducers; the result for #58220 is labeled separately.

    Verified using the native Hermes/Fabric Fantom runner on main cd2de187e8878119896159371225acbb9dfa5d9c. The unsupported-value case still fails: coercion runs instead of producing the expected DataCloneError.

    This is a constructed example based on the source audit, not a claimed production incident. The PR includes the exact native verification driver and results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: 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