Closed Bug 1653291 Opened 3 months ago Closed 2 months ago

Make "locales" and "options" arguments and the "type" property mandatory for Intl.DisplayNames

Categories

(Core :: JavaScript: Internationalization API, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(4 files)

Make "locales" and "options" arguments and the "type" property mandatory for Intl.DisplayNames per the latest spec proposal changes. Also canonicalise the input arguments to the of() method.

Severity: -- → N/A
Priority: -- → P2

Moves the fallback handling from JS into C++ code, because the language, script,
and region tags were already canonicalised in C++, so handling the fallback path
in C++ altogether avoids repeated canonicalisation.

Drive-by:
Change Intl_DisplayNames_of to call ToString(code) before getDisplayNamesInternals()
following comments from a previous review.

"month" is the only date-time type which may return an empty string (only for
Undecimber, though). Handle this case and also assert all other date-time types
always return a non-empty result.

Depends on D83944

Zero initialisation is cheap for this case (two mov for script and a single
mov for region types).

Depends on D83945

Drive-by change:
Enable now passing test262 tests which weren't updated in the last test262 update.

Depends on D83946

Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/29b831c685f0
Part 1: Canonicalise input arguments to Intl.DisplayNames.p.of(). r=jwalden
https://hg.mozilla.org/integration/autoland/rev/c57a391c7063
Part 2: Canonicalise "month" for Intl.DisplayNames. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/0f66e6b2e06c
Part 3: Zero initialise the script and region char arrays. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/5c653e761010
Part 4: Require 'locales' and 'options' arguments. r=jwalden
You need to log in before you can comment on or make changes to this bug.