Commit 65cc04fb authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] fix Intl.ListFormat / RelativeTimeFormat subclassing bug

Bug: v8:8030, v8:8031
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Iaac58cc3a692ea9d7c986b24414403b57d00b904
Reviewed-on: https://chromium-review.googlesource.com/1180084Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55322}
parent 11261f42
......@@ -13082,7 +13082,9 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
case JS_GENERATOR_OBJECT_TYPE:
#ifdef V8_INTL_SUPPORT
case JS_INTL_COLLATOR_TYPE:
case JS_INTL_LIST_FORMAT_TYPE:
case JS_INTL_PLURAL_RULES_TYPE:
case JS_INTL_RELATIVE_TIME_FORMAT_TYPE:
#endif
case JS_ASYNC_GENERATOR_OBJECT_TYPE:
case JS_MAP_TYPE:
......
// Copyright 2018 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.
// Flags: --harmony-intl-relative-time-format
var locales = ["tlh", "id", "en"];
var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales);
var referenceFormatted = referenceRelativeTimeFormat.format(3, "day");
class MyFormat extends Intl.RelativeTimeFormat {
constructor(locales, options) {
super(locales, options);
// could initialize MyRelativeTimeFormat properties
}
// could add methods to MyRelativeTimeFormat.prototype
}
var format = new MyFormat(locales);
var actual = format.format(3, "day");
assertEquals(actual, referenceFormatted);
// Copyright 2018 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.
// Flags: --harmony-intl-list-format
var locales = ["tlh", "id", "en"];
var input = ["a", "b", "c"];
var referenceListFormat = new Intl.ListFormat(locales);
var referenceFormatted = referenceListFormat.format(input);
class MyFormat extends Intl.ListFormat {
constructor(locales, options) {
super(locales, options);
// could initialize MyListFormat properties
}
// could add methods to MyListFormat.prototype
}
var format = new MyFormat(locales);
var actual = format.format(input);
assertEquals(actual, referenceFormatted);
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