Skip to content

unmountChildren was missing an Object.hasOwnProperty check (src/core/ReactChildReconciler.js) #3749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2015

Conversation

VictorKoenders
Copy link
Contributor

Adding a method to Object.prototype caused react to crash on me when unloading a component. Turns out that ReactChildReconciler::unmountChildren was missing a check renderedChildren.hasOwnProperty(name)

@sophiebits
Copy link
Collaborator

I'll take this for consistency with the other functions here, but I'd really discourage you from mutating Object.prototype. Most libraries break if you do. For example, jQuery doesn't support it.

sophiebits added a commit that referenced this pull request Apr 26, 2015
unmountChildren was missing an Object.hasOwnProperty check (src/core/ReactChildReconciler.js)
@sophiebits sophiebits merged commit 8e9deff into facebook:master Apr 26, 2015
@zpao
Copy link
Member

zpao commented Apr 27, 2015

Yea, we'll definitely break in other places too (eg, #3665 was entirely about getting rid of hasOwnProperty for objects we created and know can't have certain keys that would be an issue). This looks like a case where we're already using our generated ids as keys so we should be able to consider it safe.

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

Successfully merging this pull request may close these issues.

5 participants