-
Notifications
You must be signed in to change notification settings - Fork 25.3k
structuredClone loses specialized Error prototypes #58214
Copy link
Copy link
Open
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
Activity
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
The React Native
structuredClonepolyfill validates an Error's standard serialized name but always constructs a baseError, then overwrites only.name. A clonedEvalError, for example, reportsname === 'EvalError'while failinginstanceof EvalError. The same affects RangeError, ReferenceError, SyntaxError, TypeError, and URIError.Expected behavior
Valid standard Error names should be cloned with their matching built-in constructor/prototype; invalid names should fall back to base Error. Native
structuredClonefollows this behavior.React Native Version
0.87.1 and current main
Affected Platforms
JavaScript runtime - All