-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Editorial: Don't allow writing NaN to frozen properties #3404
Conversation
spec.html
Outdated
@@ -12748,7 12748,7 @@ <h1> | |||
1. If _Desc_ has a [[Set]] field and SameValue(_Desc_.[[Set]], _current_.[[Set]]) is *false*, return *false*. | |||
1. Else if _current_.[[Writable]] is *false*, then | |||
1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *true*, return *false*. | |||
1. If _Desc_ has a [[Value]] field and SameValue(_Desc_.[[Value]], _current_.[[Value]]) is *false*, return *false*. | |||
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a note to discourage future would-be refactorings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you have a concrete suggestion on hand, I'd rather not delay this indefinitely. We could always add the note in a follow-up, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: The following is not equivalent to returning false when SameValue returns false in the case of NaN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I don't like that wording. I'd say something like "the following step must not fall through to the property configuration steps below, even when SameValue returns true, because NaN values may be distinguishable".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). | |
1. NOTE: SameValue returns true for *NaN* values which may be distinguishable by other means. Returning here ensures that any existing property of _O_ remains unmodified. | |
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also WFM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*true*
btw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, wfm too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
spec.html
Outdated
@@ -12748,7 12748,7 @@ <h1> | |||
1. If _Desc_ has a [[Set]] field and SameValue(_Desc_.[[Set]], _current_.[[Set]]) is *false*, return *false*. | |||
1. Else if _current_.[[Writable]] is *false*, then | |||
1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *true*, return *false*. | |||
1. If _Desc_ has a [[Value]] field and SameValue(_Desc_.[[Value]], _current_.[[Value]]) is *false*, return *false*. | |||
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). | |
1. NOTE: SameValue returns true for *NaN* values which may be distinguishable by other means. Returning here ensures that any existing property of _O_ remains unmodified. | |
1. If _Desc_ has a [[Value]] field, return SameValue(_Desc_.[[Value]], _current_.[[Value]]). |
…spidermonkey-reviewers,jandem `ValidateAndApplyPropertyDescriptor` was refactored in <tc39/ecma262#2468>, make sure our implementation follows the current spec text more closely. But also include the fix from <tc39/ecma262#3404>. Differential Revision: https://phabricator.services.mozilla.com/D220231
…spidermonkey-reviewers,jandem `ValidateAndApplyPropertyDescriptor` was refactored in <tc39/ecma262#2468>, make sure our implementation follows the current spec text more closely. But also include the fix from <tc39/ecma262#3404>. Differential Revision: https://phabricator.services.mozilla.com/D220231
…spidermonkey-reviewers,jandem `ValidateAndApplyPropertyDescriptor` was refactored in <tc39/ecma262#2468>, make sure our implementation follows the current spec text more closely. But also include the fix from <tc39/ecma262#3404>. Differential Revision: https://phabricator.services.mozilla.com/D220231
If an implementation can produce distinguishable NaN values, then writing NaN values to a frozen (non-configurable and non-writable) property can be detectable.
If an implementation can produce distinguishable NaN values, then writing NaN values to a frozen (non-configurable and non-writable) property can be detectable.
This is a regression from #2468.