371d7dbcc3
This reverts commit c9c3ec4c14
.
Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/34616/overview (looks unrelated, but fails consistently since this CL)
Original change's description:
> [intl] Clean up intl_segmenter flag
>
> Intl.Segmenter shipped in m87 and launched.
>
> Bug: v8:11225
> Change-Id: I4213e261e1aea717c1281f19785a8c29ff1bbd8b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2570461
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Shu-yu Guo <syg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#71653}
TBR=jkummerow@chromium.org,ftang@chromium.org,syg@chromium.org
Change-Id: Ic1d1b02abb9ae7faa41307eee694bb7e40d0fae2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:11225
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2578979
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71657}
100 lines
3.4 KiB
JavaScript
100 lines
3.4 KiB
JavaScript
// 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-segmenter
|
|
|
|
let seg = new Intl.Segmenter();
|
|
let descriptor = Object.getOwnPropertyDescriptor(
|
|
Intl.Segmenter, "supportedLocalesOf");
|
|
assertTrue(descriptor.writable);
|
|
assertFalse(descriptor.enumerable);
|
|
assertTrue(descriptor.configurable);
|
|
|
|
let segmenterPrototype = Object.getPrototypeOf(seg);
|
|
assertEquals("Intl.Segmenter", segmenterPrototype[Symbol.toStringTag]);
|
|
|
|
// ecma402 #sec-Intl.Segmenter.prototype
|
|
// Intl.Segmenter.prototype
|
|
// The value of Intl.Segmenter.prototype is %SegmenterPrototype%.
|
|
// This property has the attributes
|
|
// { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
|
descriptor = Object.getOwnPropertyDescriptor(Intl.Segmenter, "prototype");
|
|
assertFalse(descriptor.writable);
|
|
assertFalse(descriptor.enumerable);
|
|
assertFalse(descriptor.configurable);
|
|
|
|
for (let func of ["segment", "resolvedOptions"]) {
|
|
let descriptor = Object.getOwnPropertyDescriptor(
|
|
Intl.Segmenter.prototype, func);
|
|
assertTrue(descriptor.writable);
|
|
assertFalse(descriptor.enumerable);
|
|
assertTrue(descriptor.configurable);
|
|
}
|
|
|
|
|
|
let segments = seg.segment('text');
|
|
let segmentsPrototype = Object.getPrototypeOf(segments);
|
|
for (let func of ["containing", Symbol.iterator]) {
|
|
let descriptor = Object.getOwnPropertyDescriptor(segmentsPrototype, func);
|
|
assertTrue(descriptor.writable);
|
|
assertFalse(descriptor.enumerable);
|
|
assertTrue(descriptor.configurable);
|
|
}
|
|
|
|
function checkGetterProperty(prototype, property) {
|
|
let desc = Object.getOwnPropertyDescriptor(prototype, property);
|
|
assertEquals(`get ${property}`, desc.get.name);
|
|
assertEquals('function', typeof desc.get)
|
|
assertEquals(undefined, desc.set);
|
|
assertFalse(desc.enumerable);
|
|
assertTrue(desc.configurable);
|
|
}
|
|
|
|
// Test the SegmentsPrototype methods are called with same
|
|
// receiver and won't throw.
|
|
assertDoesNotThrow(() => segmentsPrototype.containing.call(segments));
|
|
assertDoesNotThrow(() => segmentsPrototype[Symbol.iterator].call(segments));
|
|
|
|
// Test the SegmentIteratorPrototype methods are called with a different
|
|
// receiver and correctly throw.
|
|
var otherReceivers = [
|
|
1, 123.45, undefined, null, "string", true, false,
|
|
Intl, Intl.Segmenter, Intl.Segmenter.prototype,
|
|
segmentsPrototype,
|
|
new Intl.Segmenter(),
|
|
new Intl.Collator(),
|
|
new Intl.DateTimeFormat(),
|
|
new Intl.NumberFormat(),
|
|
];
|
|
for (let rec of otherReceivers) {
|
|
assertThrows(() => segmentsPrototype.containing.call(rec), TypeError);
|
|
}
|
|
|
|
let segmentIterator = segments[Symbol.iterator]();
|
|
let segmentIteratorPrototype = Object.getPrototypeOf(segmentIterator);
|
|
for (let func of ["next"]) {
|
|
let descriptor = Object.getOwnPropertyDescriptor(segmentIteratorPrototype,
|
|
func);
|
|
assertTrue(descriptor.writable);
|
|
assertFalse(descriptor.enumerable);
|
|
assertTrue(descriptor.configurable);
|
|
}
|
|
|
|
assertEquals("Segmenter String Iterator",
|
|
segmentIteratorPrototype[Symbol.toStringTag]);
|
|
let desc = Object.getOwnPropertyDescriptor(
|
|
segmentIteratorPrototype, Symbol.toStringTag);
|
|
assertFalse(desc.writable);
|
|
assertFalse(desc.enumerable);
|
|
assertTrue(desc.configurable);
|
|
|
|
let nextReturn = segmentIterator.next();
|
|
|
|
function checkProperty(obj, property) {
|
|
let desc = Object.getOwnPropertyDescriptor(obj, property);
|
|
assertTrue(desc.writable);
|
|
assertTrue(desc.enumerable);
|
|
assertTrue(desc.configurable);
|
|
}
|