Closed Bug 866596 Opened 11 years ago Closed 9 years ago

Intl: IsStructurallyValidLanguageTag does not detect duplicate variants/singletons with different case

Categories

(Core :: JavaScript: Internationalization API, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: anba, Assigned: Waldo)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0
Build ID: 20130409194949

Steps to reproduce:

test case with variants:
js> new Intl.Collator("de-tester-Tester")

This should raise a RangeError, because the variant "tester" appears twice in the language tag. It seems to trigger an internal error, though, because the expression gives no return value...

test case with singletons:
js> new Intl.Collator("de-DE-u-kn-true-U-kn-true")

This should raise a RangeError as well, the singleton "u" appears twice in the input string. (Note: This does not trigger an internal error, that means a Collator instance is returned.)
Bug 912701 added more descriptive assertion messages:

js> new Intl.Collator("de-tester-Tester")
Self-hosted JavaScript assertion info: "invalid BestAvailableLocale locale structure"
Status: UNCONFIRMED → NEW
Ever confirmed: true
Mass-moving existing Intl-related bugs to the new Core :: JavaScript: Internationalization API component.

If you think this bug has been moved in error, feel free to move it back to Core :: JavaScript Engine.

[Mass change filter: core-js-intl-api-move]
Component: JavaScript Engine → JavaScript: Internationalization API
Original test case no longer triggers assertion (cf. bug 919872).

New test case:
---
new Intl.Collator("de-tester-Tester").compare("a", "a")
---
Assignee: general → nobody
Attached patch PatchSplinter Review
This stuff is too immediate in mind for me to let it sit, not when minor regular expression fixes quickly paper over them.
Attachment #8627858 - Flags: review?(andrebargull)
Assignee: nobody → jwalden+bmo
Status: NEW → ASSIGNED
Comment on attachment 8627858 [details] [diff] [review]
Patch

Review of attachment 8627858 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.

::: js/src/builtin/Intl.js
@@ +257,5 @@
>  
> +    // Language tags are case insensitive (RFC 5646 section 2.1.1).  Using
> +    // character classes covering both upper- and lower-case characters nearly
> +    // addresses this -- but for the possibility of singleton repetition with
> +    // differing case, e.g. "en-u-foo-U-foo".  Use a case-insensitive regular

s/singleton/variant/
s/en-u-foo-U-foo/en-variant-Variant/
Attachment #8627858 - Flags: review?(andrebargull) → review+
https://hg.mozilla.org/mozilla-central/rev/908feb832a66
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: