dillon1000/react

Commit

don't try to use Object.prototype methods as transfer strategies in ReactPropTransferer.mergeProps

While looking up a detail of how `transferPropsTo()` works I noticed that we never check `TransferStrategies.hasOwnProperty(thisKey)` when merging props, just `newProps.hasOwnProperty(thisKey)` and a truthy test for `TransferStrategies[thisKey]`. This means that if our `newProps` has keys like `toString`, `valueOf`, or `constructor` etc. set, we will pull these functions off `TransferStrategies` and invoke them when merging props. In most cases this will just result in a failure to merge and some code without side effects being run but in the case of `valueOf` it will actually generate an exception.
Browse files
Changed paths1 file
First-parent comparison
M src/core/ReactPropTransferer.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…