Skip to content
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

Add patch for Object.defineProperties. #53

Merged
merged 2 commits into from May 28, 2015

Conversation

RReverser
Copy link
Contributor

Closes #51.

Object.defineProperties = function(subject, descs) {
var vhandler = directProxies.get(subject);
if (vhandler !== undefined) {
var names = prim_getOwnPropertyNames(descs);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ES5 spec mentions that only the enumerable own properties of the descs object are considered. So you should use Object.keys here. Also, descs might be a proxy so it's best to call the patched Object.keys, as prim_keys will not work when descs is a proxy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated PR.

@tvcutsem
Copy link
Owner

Apart from the comment on Object.keys, this is excellent. Thanks.

tvcutsem added a commit that referenced this pull request May 28, 2015
Add patch for Object.defineProperties.
@tvcutsem tvcutsem merged commit ff2c1e7 into tvcutsem:master May 28, 2015
@RReverser RReverser deleted the defineProperties branch May 29, 2015 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Patch Object.defineProperties
2 participants