[Intl] Define @@toStringTag for Intl namespace
Implement https://github.com/tc39/ecma402/pull/487 Also improve test/intl/toStringTag.js see also: https://github.com/tc39/test262/pull/2712 Bug: v8:10744 Change-Id: I678876aa21f169a8dfcec8e3ce974978a8847fe0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2315455 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#69185}
This commit is contained in:
parent
5277adef17
commit
439c868ffa
@ -2761,6 +2761,11 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld);
|
||||
JSObject::AddProperty(isolate_, global, "Intl", intl, DONT_ENUM);
|
||||
|
||||
// ecma402 #sec-Intl-toStringTag
|
||||
// The initial value of the @@toStringTag property is the string value
|
||||
// *"Intl"*.
|
||||
InstallToStringTag(isolate_, intl, "Intl");
|
||||
|
||||
SimpleInstallFunction(isolate(), intl, "getCanonicalLocales",
|
||||
Builtins::kIntlGetCanonicalLocales, 1, false);
|
||||
|
||||
|
@ -4,26 +4,21 @@
|
||||
|
||||
let descriptor;
|
||||
|
||||
descriptor = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype,
|
||||
Symbol.toStringTag);
|
||||
|
||||
assertEquals("Intl.DateTimeFormat", descriptor.value);
|
||||
assertFalse(descriptor.writable);
|
||||
assertFalse(descriptor.enumerable);
|
||||
assertTrue(descriptor.configurable);
|
||||
|
||||
descriptor = Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype,
|
||||
Symbol.toStringTag);
|
||||
|
||||
assertEquals("Intl.NumberFormat", descriptor.value);
|
||||
assertFalse(descriptor.writable);
|
||||
assertFalse(descriptor.enumerable);
|
||||
assertTrue(descriptor.configurable);
|
||||
|
||||
descriptor = Object.getOwnPropertyDescriptor(Intl.Collator.prototype,
|
||||
Symbol.toStringTag);
|
||||
|
||||
assertEquals("Intl.Collator", descriptor.value);
|
||||
assertFalse(descriptor.writable);
|
||||
assertFalse(descriptor.enumerable);
|
||||
assertTrue(descriptor.configurable);
|
||||
for (const [obj, tag] of
|
||||
[[Intl, "Intl"],
|
||||
[Intl.Collator.prototype, "Intl.Collator"],
|
||||
[Intl.DateTimeFormat.prototype, "Intl.DateTimeFormat"],
|
||||
[Intl.DisplayNames.prototype, "Intl.DisplayNames"],
|
||||
[Intl.Locale.prototype, "Intl.Locale"],
|
||||
[Intl.ListFormat.prototype, "Intl.ListFormat"],
|
||||
[Intl.NumberFormat.prototype, "Intl.NumberFormat"],
|
||||
[Intl.RelativeTimeFormat.prototype, "Intl.RelativeTimeFormat"],
|
||||
[Intl.PluralRules.prototype, "Intl.PluralRules"],
|
||||
]) {
|
||||
descriptor = Object.getOwnPropertyDescriptor(obj,
|
||||
Symbol.toStringTag);
|
||||
assertEquals(tag, descriptor.value);
|
||||
assertFalse(descriptor.writable);
|
||||
assertFalse(descriptor.enumerable);
|
||||
assertTrue(descriptor.configurable);
|
||||
}
|
||||
|
@ -453,6 +453,9 @@
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=7472
|
||||
'intl402/NumberFormat/currency-digits': [FAIL],
|
||||
|
||||
# http://crbug/v8/10744
|
||||
'intl402/Intl/builtin': [FAIL],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=7831
|
||||
'language/statements/generators/generator-created-after-decl-inst': [FAIL],
|
||||
'language/expressions/generators/generator-created-after-decl-inst': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user