| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index a6d1de705aca385323251e0d3fd46f70fda25dde..fc36ca1c650a90b1ac664b4ea59e9e9603e87d36 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -24631,6 +24631,32 @@ TEST(Set) {
|
| CHECK_EQ(0U, set->Size());
|
| }
|
|
|
| +TEST(SetDeleteThenAsArray) {
|
| + // https://bugs.chromium.org/p/v8/issues/detail?id=4946
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| + v8::HandleScope handle_scope(isolate);
|
| + LocalContext env;
|
| +
|
| + // make an array
|
| + v8::Local<v8::Value> val = CompileRun("new Set([1, 2, 3])");
|
| + v8::Local<v8::Set> set = v8::Local<v8::Set>::Cast(val);
|
| + CHECK_EQ(3U, set->Size());
|
| +
|
| + // delete the "middle" element (using AsArray to
|
| + // determine which element is the "middle" element)
|
| + v8::Local<v8::Array> array1 = set->AsArray();
|
| + CHECK_EQ(3U, array1->Length());
|
| + CHECK(set->Delete(env.local(), array1->Get(env.local(), 1).ToLocalChecked())
|
| + .FromJust());
|
| +
|
| + // make sure there are no undefined values when we convert to an array again.
|
| + v8::Local<v8::Array> array2 = set->AsArray();
|
| + uint32_t length = array2->Length();
|
| + CHECK_EQ(2U, length);
|
| + for (uint32_t i = 0; i < length; i++) {
|
| + CHECK(!array2->Get(env.local(), i).ToLocalChecked()->IsUndefined());
|
| + }
|
| +}
|
|
|
| TEST(CompatibleReceiverCheckOnCachedICHandler) {
|
| v8::Isolate* isolate = CcTest::isolate();
|
|
|