OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 24613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24624 | 24624 |
24625 CHECK(set->Delete(env.local(), set).FromJust()); | 24625 CHECK(set->Delete(env.local(), set).FromJust()); |
24626 CHECK_EQ(2U, set->Size()); | 24626 CHECK_EQ(2U, set->Size()); |
24627 CHECK(!set->Has(env.local(), set).FromJust()); | 24627 CHECK(!set->Has(env.local(), set).FromJust()); |
24628 CHECK(!set->Delete(env.local(), set).FromJust()); | 24628 CHECK(!set->Delete(env.local(), set).FromJust()); |
24629 | 24629 |
24630 set->Clear(); | 24630 set->Clear(); |
24631 CHECK_EQ(0U, set->Size()); | 24631 CHECK_EQ(0U, set->Size()); |
24632 } | 24632 } |
24633 | 24633 |
| 24634 TEST(SetDeleteThenAsArray) { |
| 24635 // https://bugs.chromium.org/p/v8/issues/detail?id=4946 |
| 24636 v8::Isolate* isolate = CcTest::isolate(); |
| 24637 v8::HandleScope handle_scope(isolate); |
| 24638 LocalContext env; |
| 24639 |
| 24640 // make an array |
| 24641 v8::Local<v8::Value> val = CompileRun("new Set([1, 2, 3])"); |
| 24642 v8::Local<v8::Set> set = v8::Local<v8::Set>::Cast(val); |
| 24643 CHECK_EQ(3U, set->Size()); |
| 24644 |
| 24645 // delete the "middle" element (using AsArray to |
| 24646 // determine which element is the "middle" element) |
| 24647 v8::Local<v8::Array> array1 = set->AsArray(); |
| 24648 CHECK_EQ(3U, array1->Length()); |
| 24649 CHECK(set->Delete(env.local(), array1->Get(env.local(), 1).ToLocalChecked()) |
| 24650 .FromJust()); |
| 24651 |
| 24652 // make sure there are no undefined values when we convert to an array again. |
| 24653 v8::Local<v8::Array> array2 = set->AsArray(); |
| 24654 uint32_t length = array2->Length(); |
| 24655 CHECK_EQ(2U, length); |
| 24656 for (uint32_t i = 0; i < length; i++) { |
| 24657 CHECK(!array2->Get(env.local(), i).ToLocalChecked()->IsUndefined()); |
| 24658 } |
| 24659 } |
24634 | 24660 |
24635 TEST(CompatibleReceiverCheckOnCachedICHandler) { | 24661 TEST(CompatibleReceiverCheckOnCachedICHandler) { |
24636 v8::Isolate* isolate = CcTest::isolate(); | 24662 v8::Isolate* isolate = CcTest::isolate(); |
24637 v8::HandleScope scope(isolate); | 24663 v8::HandleScope scope(isolate); |
24638 v8::Local<v8::FunctionTemplate> parent = FunctionTemplate::New(isolate); | 24664 v8::Local<v8::FunctionTemplate> parent = FunctionTemplate::New(isolate); |
24639 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, parent); | 24665 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, parent); |
24640 auto returns_42 = | 24666 auto returns_42 = |
24641 v8::FunctionTemplate::New(isolate, Returns42, Local<Value>(), signature); | 24667 v8::FunctionTemplate::New(isolate, Returns42, Local<Value>(), signature); |
24642 parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42); | 24668 parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42); |
24643 v8::Local<v8::FunctionTemplate> child = v8::FunctionTemplate::New(isolate); | 24669 v8::Local<v8::FunctionTemplate> child = v8::FunctionTemplate::New(isolate); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25020 } | 25046 } |
25021 | 25047 |
25022 TEST(PrivateForApiIsNumber) { | 25048 TEST(PrivateForApiIsNumber) { |
25023 LocalContext context; | 25049 LocalContext context; |
25024 v8::Isolate* isolate = CcTest::isolate(); | 25050 v8::Isolate* isolate = CcTest::isolate(); |
25025 v8::HandleScope scope(isolate); | 25051 v8::HandleScope scope(isolate); |
25026 | 25052 |
25027 // Shouldn't crash. | 25053 // Shouldn't crash. |
25028 v8::Private::ForApi(isolate, v8_str("42")); | 25054 v8::Private::ForApi(isolate, v8_str("42")); |
25029 } | 25055 } |
OLD | NEW |