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

Protect against hasOwnProperty being overwritten #97

Merged
merged 1 commit into from Jan 29, 2012

Conversation

Projects
None yet
2 participants
@alassek
Contributor

alassek commented Jan 29, 2012

See this blog post for rationale.

Currently, Sugar is susceptible to this bug in a few places, notably Object.extended:

Object.extended({ hasOwnProperty: true }) // TypeError: obj.hasOwnProperty is not a function

This PR adds Object.has as a shortcut to Object.prototype.hasOwnProperty, and replaces internal use of Object#hasOwnProperty.

andrewplummer added a commit that referenced this pull request Jan 29, 2012

Merge pull request #97 from alassek/object-has
Protect against hasOwnProperty being overwritten

@andrewplummer andrewplummer merged commit a74f161 into andrewplummer:master Jan 29, 2012

@andrewplummer

This comment has been minimized.

Owner

andrewplummer commented Jan 29, 2012

Thanks for this change! And +1 for adding docs and tests... it makes a huge difference when considering these things. FYI I changed the internal method to be hasOwnProperty just to be more explicit.

andrewplummer added a commit that referenced this pull request Aug 4, 2015

Merge pull request #97 from alassek/object-has
Protect against hasOwnProperty being overwritten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment