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

Fix JSON-serialization issues (function-valued properties) #1037

Merged
merged 2 commits into from Dec 31, 2021

Conversation

resnickj
Copy link
Contributor

Issues:

  • function-valued properties should be excluded entirely from JSON, not serialized as objects
  • proxies incorrectly treated as callable

Changes:

  • Remove extraneous early exit case (JsonSerializer line 175) which diverges from the algorithm in the spec (https://tc39.es/ecma262/#sec-serializejsonproperty). This appears to correct the serialization of function-valued properties, but unmasks another issue where ProxyInstance is mistakenly treated as callable even when target is not
  • Change "value is ICallbable" test to "value.IsCallable" so that serialization of ProxyInstance is handled correctly (according to the spec proxies are callable only if the target is callable - https://tc39.es/ecma262/#sec-proxycreate)
  • Add test to verify serialization of function-valued properties

Issues:
* function-valued properties should be excluded entirely from JSON, not serialized as objects
* proxies to functions are not handled correctly

Changes:
* Remove extraneous early exit case (JsonSerializer line 175) which diverges from the algorithm in the spec (https://tc39.es/ecma262/#sec-serializejsonproperty). This appears to correct the serialization of function-valued properties, but unmasks another issue where ProxyInstance is mistakenly treated as callable even when target is not
* Change "value is ICallbable" test to "value.IsCallable" so that serialization of ProxyInstance is handled correctly (according to the spec proxies are callable only if the target is callable - https://tc39.es/ecma262/#sec-proxycreate)
* Add test to verify serialization of function-valued properties
@lahma lahma merged commit 8e8cae4 into sebastienros:main Dec 31, 2021
@lahma
Copy link
Collaborator

lahma commented Dec 31, 2021

Thank you!

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.

None yet

2 participants