-
Notifications
You must be signed in to change notification settings - Fork 157
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
GetOptionsObject
vs OrdinaryObjectCreate(%Object.prototype%)
#2098
Comments
This comment was marked as resolved.
This comment was marked as resolved.
options
argument is needed, which creates a new object inheriting from null
instead of Object.prototype
. A bunch of other places instead do OrdinaryObjectCreate(%Object.prototype%)
. It seems like these should be consistent, and (as a non-editorial opinion) NormalizeOptionsObject seems better: I wouldn't expect omitting an options argument to cause lookups on Object.prototype.NormalizeOptionsObject
vs OrdinaryObjectCreate(%Object.prototype%)
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I thought this was fixed already; are there any places left where an options object created within Temporal does not have a null prototype? |
Note that |
NormalizeOptionsObject
vs OrdinaryObjectCreate(%Object.prototype%)
GetOptionsObject
vs OrdinaryObjectCreate(%Object.prototype%)
I found:
Plus getISOFields, DateTimeFormat, and the Temporal objects themselves, but those seem fine. |
I agree PlainYearMonth.add/subtract and MergeLargestUnitOption should be fixed. mergeFields/DefaultMergeFields and PrepareTemporalFields/PreparePartialTemporalFields I didn't consider before because they weren't options objects. But maybe it makes sense to make these into null prototype objects too. For objects returned from PrepareTemporalFields it really shouldn't matter because we only Get properties that are guaranteed to be own data properties of the object. But for PreparePartialTemporalFields, you could write some evil code where it is observable: Temporal.PlainDate.from('2022-01-01').with({
get year() {
Object.prototype.day = 31;
return 2023;
},
}); You'd expect this to result in 2021-01-01 but it might result in 2021-01-31... |
I'd say:
|
Sounds like we agree. If PrepareTemporalFields doesn't matter, then probably we should still change it for consistency with PreparePartialTemporalFields, since consistency is the reason the issue was opened in the first place. |
Some earlier discussion in #1424
The text was updated successfully, but these errors were encountered: