Commit 470d8a2e authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Fix extra propertes in resolvedOptions

While dateStyle or timeStye is specified, we should not
add property listed in "Table Components of date and time formats"
per https://tc39.github.io/proposal-intl-datetime-style/#sec-initializedatetimeformat

Bug: v8:9107
Change-Id: I3e39112ed5f99b05f30b2f50f3cd3102d094f98e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559213Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60725}
parent cb989656
......@@ -495,16 +495,22 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
}
}
for (const auto& item : GetPatternItems()) {
for (const auto& pair : item.pairs) {
if (pattern.find(pair.pattern) != std::string::npos) {
CHECK(JSReceiver::CreateDataProperty(
isolate, options,
factory->NewStringFromAsciiChecked(item.property.c_str()),
factory->NewStringFromAsciiChecked(pair.value.c_str()),
Just(kDontThrow))
.FromJust());
break;
// If dateStyle and timeStyle are undefined, then internal slots
// listed in "Table 1: Components of date and time formats" will be set
// in Step 33.f.iii.1 of InitializeDateTimeFormat
if (date_time_format->date_style() == DateTimeStyle::kUndefined &&
date_time_format->time_style() == DateTimeStyle::kUndefined) {
for (const auto& item : GetPatternItems()) {
for (const auto& pair : item.pairs) {
if (pattern.find(pair.pattern) != std::string::npos) {
CHECK(JSReceiver::CreateDataProperty(
isolate, options,
factory->NewStringFromAsciiChecked(item.property.c_str()),
factory->NewStringFromAsciiChecked(pair.value.c_str()),
Just(kDontThrow))
.FromJust());
break;
}
}
}
}
......
......@@ -36,10 +36,6 @@ var expectedProperties = [
'timeZone',
'hourCycle',
'hour12',
'weekday',
'year',
'month',
'day',
'dateStyle',
];
......
......@@ -36,14 +36,6 @@ var expectedProperties = [
'timeZone',
'hourCycle',
'hour12',
'weekday',
'year',
'month',
'day',
'hour',
'minute',
'second',
'timeZoneName',
'dateStyle',
'timeStyle',
];
......
......@@ -36,10 +36,6 @@ var expectedProperties = [
'timeZone',
'hourCycle',
'hour12',
'hour',
'minute',
'second',
'timeZoneName',
'timeStyle',
];
......
......@@ -51,6 +51,7 @@ FEATURE_FLAGS = {
'String.prototype.matchAll': '--harmony-string-matchall',
'Symbol.matchAll': '--harmony-string-matchall',
'numeric-separator-literal': '--harmony-numeric-separator',
'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style',
'Intl.Locale': '--harmony-locale',
'Intl.Segmenter': '--harmony-intl-segmenter',
'Symbol.prototype.description': '--harmony-symbol-description',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment