-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
V8 icu patch 4.x #15562
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
Closed
Closed
V8 icu patch 4.x #15562
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4cb743d
build: run test-hash-seed at the end of test-v8
targos 3d357eb
deps: backport e28183b5 from upstream V8
skomski 2ac6192
deps: cherry pick d7f813b4 from V8 upstream
875e396
build: fix make test-v8
bnoordhuis 82b2436
deps: backport bff3074 from V8 upstream
MylesBorins 0cc8102
deps: backport 4e18190 from V8 upstream
jungshik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
deps: backport 4e18190 from V8 upstream
Original commit message:
Timezone name check fix
1. Location names with more than one underscores (e.g. Ho_Chi_Minh)
didn't work because of the way capturing works with repeated patterns
in RE. It's now supported by changing the RE to capture the whole string
and splitting on '_' in the next step.
2. Adds support for location names with a hyphen
3. Adds support for timezone ids with three parts (e.g.
American/Argentina/Buenos_Aires)
4. Adds special handling of 'au', 'es' and 'of' in zone ids. They need to be kept in lowercase. (see the full list at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones )
5. Adds regression tests for all the above and make the existing tests
more robust against future ICU changes. ICU canonicalizes zone names to
deprecated names, but it may change. (
http://bugs.icu-project.org/trac/ticket/12044 )
BUG=364374
LOG=Y
Review URL: https://codereview.chromium.org/1529363005
Cr-Commit-Position: refs/heads/master@{#33097}
PR-URL: #15562- Loading branch information
commit 0cc8102a3c34c2ca5faf89fb3ece8a7a6f97d877
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright 2015 the V8 project authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| if (this.Intl) { | ||
| // chromium:364374 | ||
|
|
||
| // Locations with 2 underscores are accepted and normalized. | ||
| // 'of' and 'es' are always lowercased. | ||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'eUrope/isLe_OF_man'}) | ||
| assertEquals('Europe/Isle_of_Man', df.resolvedOptions().timeZone); | ||
|
|
||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'africa/Dar_eS_salaam'}) | ||
| assertEquals('Africa/Dar_es_Salaam', df.resolvedOptions().timeZone); | ||
|
|
||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/port_of_spain'}) | ||
| assertEquals('America/Port_of_Spain', df.resolvedOptions().timeZone); | ||
|
|
||
| // Zone ids with more than 2 parts are accepted and normalized. | ||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/north_Dakota/new_salem'}) | ||
| assertEquals('America/North_Dakota/New_Salem', df.resolvedOptions().timeZone); | ||
|
|
||
| // 3-part zone IDs are accepted and normalized. | ||
| // Two Buenose Aires aliases are identical. | ||
| df1 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/aRgentina/buenos_aIres'}) | ||
| df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/Argentina/Buenos_Aires'}) | ||
| assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
| df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/Buenos_Aires'}) | ||
| assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
| df1 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/Indiana/Indianapolis'}) | ||
| df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/Indianapolis'}) | ||
| assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
| // ICU does not recognize East-Indiana. Add later when it does. | ||
| // df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/East-Indiana'}) | ||
| // assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
|
|
||
| // Zone IDs with hyphens. 'au' has to be in lowercase. | ||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'America/port-aU-pRince'}) | ||
| assertEquals('America/Port-au-Prince', df.resolvedOptions().timeZone); | ||
|
|
||
| // Accepts Ho_Chi_Minh and treats it as identical to Saigon | ||
| df1 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Ho_Chi_Minh'}) | ||
| df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Saigon'}) | ||
| assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
| // Throws for invalid timezone ids. | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'Europe/_Paris'})); | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'America/New__York'})); | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'America//New_York'})); | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'America/New_York_'})); | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'America/New_Y0rk'})); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright 2015 the V8 project authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| if (this.Intl) { | ||
| // Normalizes Kat{h,}mandu (chromium:487322) | ||
| // According to the IANA timezone db, Kathmandu is the current canonical | ||
| // name, but ICU got it backward. To make this test robust against a future | ||
| // ICU change ( http://bugs.icu-project.org/trac/ticket/12044 ), | ||
| // just check that Kat(h)mandu is resolved identically. | ||
| df1 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Katmandu'}) | ||
| df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Kathmandu'}) | ||
| assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone); | ||
|
|
||
| // Normalizes Ulan_Bator to Ulaanbaatar. Unlike Kat(h)mandu, ICU got this | ||
| // right so that we make sure that Ulan_Bator is resolved to Ulaanbaatar. | ||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Ulaanbaatar'}) | ||
| assertEquals('Asia/Ulaanbaatar', df.resolvedOptions().timeZone); | ||
|
|
||
| df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Ulan_Bator'}) | ||
| assertEquals('Asia/Ulaanbaatar', df.resolvedOptions().timeZone); | ||
|
|
||
| // Throws for unsupported time zones. | ||
| assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'Aurope/Paris'})); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just noting that this is over 80 columns. I can live with that, though.