Ensure recursion is terminated on objects with cyclical references
Reviewed By: spicyj Differential Revision: D2922542 fb-gh-sync-id: 3820569027a5906ff844f1cda5e2e65c2692e235 shipit-source-id: 3820569027a5906ff844f1cda5e2e65c2692e235
This commit is contained in:
parent
4b722d6d2a
commit
bb3d8d5350
|
@ -115,7 +115,11 @@ ReactNativeBaseComponent.Mixin = {
|
|||
this._currentElement = nextElement;
|
||||
|
||||
if (__DEV__) {
|
||||
deepFreezeAndThrowOnMutationInDev(this._currentElement.props);
|
||||
for (var key in this.viewConfig.validAttributes) {
|
||||
if (nextElement.props.hasOwnProperty(key)) {
|
||||
deepFreezeAndThrowOnMutationInDev(nextElement.props[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var updatePayload = ReactNativeAttributePayload.diff(
|
||||
|
|
|
@ -42,11 +42,17 @@ function deepFreezeAndThrowOnMutationInDev(object: Object) {
|
|||
if (object.hasOwnProperty(key)) {
|
||||
object.__defineGetter__(key, identity.bind(null, object[key]));
|
||||
object.__defineSetter__(key, throwOnImmutableMutation.bind(null, key));
|
||||
}
|
||||
}
|
||||
|
||||
Object.freeze(object);
|
||||
Object.seal(object);
|
||||
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
deepFreezeAndThrowOnMutationInDev(object[key]);
|
||||
}
|
||||
}
|
||||
Object.freeze(object);
|
||||
Object.seal(object);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue