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

spec: GetOption reform for ECMA 2021 #538

Merged
merged 2 commits into from
Feb 18, 2021

Conversation

ryzokuken
Copy link
Member

Fix ECMA 2021 additions (Intl.DisplayNames and Intl.ListFormat) to work
with the new, stricter GetOption. This no longer coerces non-null
primitives to objects and instead throws a TypeError.

Fixes: #537

/cc @sffc @ptomato

Fix ECMA 2021 additions (Intl.DisplayNames and Intl.ListFormat) to work
with the new, stricter GetOption. This no longer coerces non-null
primitives to objects and instead throws a TypeError.

Fixes: tc39#537
@ryzokuken ryzokuken added the c: spec Component: spec editorial issues label Feb 16, 2021
@ryzokuken ryzokuken added this to the ES 2021 milestone Feb 16, 2021
@ryzokuken ryzokuken self-assigned this Feb 16, 2021
spec/listformat.html Outdated Show resolved Hide resolved
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
@leobalter leobalter merged commit d8c363d into tc39:master Feb 18, 2021
@ryzokuken
Copy link
Member Author

Thanks @leobalter

webkit-commit-queue pushed a commit to WebKit/WebKit that referenced this pull request Feb 19, 2021
https://bugs.webkit.org/show_bug.cgi?id=222164

Reviewed by Alexey Shvayka.

JSTests:

* stress/intl-get-options-not-using-toobject.js: Added.
(shouldThrow):

Source/JavaScriptCore:

New spec change[1] introduced stricter GetOptionsObject for relatively new Intl constructors: Intl.DisplayNames, Intl.ListFormat, and Intl.Segmenter[2].
This does not perform `ToObject`, and instead,

    1. If the input is an undefined, then it returns empty object.
    2. If the input is an object, then it returns this object.
    3. Otherwise, throwing a TypeError.

This patch implements it.

[1]: tc39/ecma402#538
[2]: tc39/proposal-intl-segmenter#132

* runtime/IntlDisplayNames.cpp:
(JSC::IntlDisplayNames::initializeDisplayNames):
* runtime/IntlListFormat.cpp:
(JSC::IntlListFormat::initializeListFormat):
* runtime/IntlObjectInlines.h:
(JSC::intlGetOptionsObject):
* runtime/IntlSegmenter.cpp:
(JSC::IntlSegmenter::initializeSegmenter):

Canonical link: https://commits.webkit.org/234348@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
philn pushed a commit to philn/old-webkit that referenced this pull request Feb 21, 2021
https://bugs.webkit.org/show_bug.cgi?id=222164

Reviewed by Alexey Shvayka.

JSTests:

* stress/intl-get-options-not-using-toobject.js: Added.
(shouldThrow):

Source/JavaScriptCore:

New spec change[1] introduced stricter GetOptionsObject for relatively new Intl constructors: Intl.DisplayNames, Intl.ListFormat, and Intl.Segmenter[2].
This does not perform `ToObject`, and instead,

    1. If the input is an undefined, then it returns empty object.
    2. If the input is an object, then it returns this object.
    3. Otherwise, throwing a TypeError.

This patch implements it.

[1]: tc39/ecma402#538
[2]: tc39/proposal-intl-segmenter#132

* runtime/IntlDisplayNames.cpp:
(JSC::IntlDisplayNames::initializeDisplayNames):
* runtime/IntlListFormat.cpp:
(JSC::IntlListFormat::initializeListFormat):
* runtime/IntlObjectInlines.h:
(JSC::intlGetOptionsObject):
* runtime/IntlSegmenter.cpp:
(JSC::IntlSegmenter::initializeSegmenter):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@273153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
anba added a commit to anba/ecma402 that referenced this pull request Feb 25, 2021
@FrankYFTang
Copy link
Contributor

FrankYFTang commented Feb 27, 2021

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 11, 2021
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 15, 2021
…yulia

Implement the changes from <tc39/ecma402#538>.

Depends on D107651

Differential Revision: https://phabricator.services.mozilla.com/D107652

UltraBlame original commit: bf6ac6e433455a5b9073284d3e4142b87249eb24
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 15, 2021
…yulia

Implement the changes from <tc39/ecma402#538>.

Depends on D107651

Differential Revision: https://phabricator.services.mozilla.com/D107652

UltraBlame original commit: bf6ac6e433455a5b9073284d3e4142b87249eb24
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 15, 2021
…yulia

Implement the changes from <tc39/ecma402#538>.

Depends on D107651

Differential Revision: https://phabricator.services.mozilla.com/D107652

UltraBlame original commit: bf6ac6e433455a5b9073284d3e4142b87249eb24
aosmond pushed a commit to aosmond/gecko that referenced this pull request Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: spec Component: spec editorial issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Intl.ListFormat and Intl.DisplayNames to use new GetOptions
5 participants