-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Clarify "for each enumerable own property" in structured clone #557
Comments
There are a few differentiating features between the two choices:
@ajklein, any comments? It sounds like we should just spec EnumerableOwnNames. |
Correct me if I am wrong, but |
(Please stop linking to the outdated spec; use https://tc39.github.io/ecma262/.) [[Enumerate]] does obtain its keys "as if by calling its [[OwnPropertyKeys]] internal method", but the ordering it returns them in is implementation-defined: "The mechanics and order of enumerating the properties is not specified but must conform to the rules specified below." |
Sorry, missed that. Regarding proxies: structured clone throws on Proxies in Firefox. This may be related to #575. |
Fixed by #727. @shvaikalesh my apologies for not asking you for review while working on that PR. Review of the revived algorithm that is in terms of the current ECMAScript standard would be most welcome. |
Hmm it appears actually #727 changed things to be all own string properties, eliminating the enumerable qualifier :-/. That is probably bad? |
Isn't that what implementations actually do though? |
Run
in Live DOM Viewer. First logs x having one property, then zero. |
That's not enumerability you're testing; that's own-ness. https://jsbin.com/radumu/edit?html,output shows that non-enumerable properties are not copied. Whereas in the new spec they are. It seems like you need a check. I'll work on a quick PR. |
Fair. (Not around to review, will land tomorrow.) |
Please, see internal structured cloning algorithm, step 8:
Should it invoke
[[OwnPropertyKeys]]
and filter by enumerability (and copy properties with symbols as keys) or just callEnumerableOwnNames
?I have tested the algorithm in Safari 9, Chrome 47 and Firefox 46 and it seems they are doing
EnumerableOwnNames
.The text was updated successfully, but these errors were encountered: