| 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 20380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20391 CHECK(object->Has(env.local(), v8_str("baz")).FromJust()); | 20391 CHECK(object->Has(env.local(), v8_str("baz")).FromJust()); |
| 20392 CHECK(!object->HasOwnProperty(env.local(), v8_str("baz")).FromJust()); | 20392 CHECK(!object->HasOwnProperty(env.local(), v8_str("baz")).FromJust()); |
| 20393 CHECK(object->HasOwnProperty(env.local(), v8_str("bla")).FromJust()); | 20393 CHECK(object->HasOwnProperty(env.local(), v8_str("bla")).FromJust()); |
| 20394 } | 20394 } |
| 20395 { // Check named getter interceptors. | 20395 { // Check named getter interceptors. |
| 20396 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20396 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 20397 templ->SetHandler(v8::NamedPropertyHandlerConfiguration( | 20397 templ->SetHandler(v8::NamedPropertyHandlerConfiguration( |
| 20398 HasOwnPropertyNamedPropertyGetter)); | 20398 HasOwnPropertyNamedPropertyGetter)); |
| 20399 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); | 20399 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); |
| 20400 CHECK(!instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); | 20400 CHECK(!instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); |
| 20401 CHECK(!instance->HasOwnProperty(env.local(), 42).FromJust()); |
| 20401 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); | 20402 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); |
| 20402 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); | 20403 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); |
| 20403 } | 20404 } |
| 20404 { // Check indexed getter interceptors. | 20405 { // Check indexed getter interceptors. |
| 20405 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20406 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 20406 templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( | 20407 templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( |
| 20407 HasOwnPropertyIndexedPropertyGetter)); | 20408 HasOwnPropertyIndexedPropertyGetter)); |
| 20408 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); | 20409 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); |
| 20409 CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); | 20410 CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); |
| 20411 CHECK(instance->HasOwnProperty(env.local(), 42).FromJust()); |
| 20410 CHECK(!instance->HasOwnProperty(env.local(), v8_str("43")).FromJust()); | 20412 CHECK(!instance->HasOwnProperty(env.local(), v8_str("43")).FromJust()); |
| 20413 CHECK(!instance->HasOwnProperty(env.local(), 43).FromJust()); |
| 20411 CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); | 20414 CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); |
| 20412 } | 20415 } |
| 20413 { // Check named query interceptors. | 20416 { // Check named query interceptors. |
| 20414 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20417 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 20415 templ->SetHandler(v8::NamedPropertyHandlerConfiguration( | 20418 templ->SetHandler(v8::NamedPropertyHandlerConfiguration( |
| 20416 0, 0, HasOwnPropertyNamedPropertyQuery)); | 20419 0, 0, HasOwnPropertyNamedPropertyQuery)); |
| 20417 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); | 20420 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); |
| 20418 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); | 20421 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); |
| 20419 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); | 20422 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); |
| 20420 } | 20423 } |
| 20421 { // Check indexed query interceptors. | 20424 { // Check indexed query interceptors. |
| 20422 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20425 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 20423 templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( | 20426 templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( |
| 20424 0, 0, HasOwnPropertyIndexedPropertyQuery)); | 20427 0, 0, HasOwnPropertyIndexedPropertyQuery)); |
| 20425 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); | 20428 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); |
| 20426 CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); | 20429 CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); |
| 20430 CHECK(instance->HasOwnProperty(env.local(), 42).FromJust()); |
| 20427 CHECK(!instance->HasOwnProperty(env.local(), v8_str("41")).FromJust()); | 20431 CHECK(!instance->HasOwnProperty(env.local(), v8_str("41")).FromJust()); |
| 20432 CHECK(!instance->HasOwnProperty(env.local(), 41).FromJust()); |
| 20428 } | 20433 } |
| 20429 { // Check callbacks. | 20434 { // Check callbacks. |
| 20430 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20435 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 20431 templ->SetAccessor(v8_str("foo"), HasOwnPropertyAccessorGetter); | 20436 templ->SetAccessor(v8_str("foo"), HasOwnPropertyAccessorGetter); |
| 20432 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); | 20437 Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); |
| 20433 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); | 20438 CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); |
| 20434 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); | 20439 CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); |
| 20435 } | 20440 } |
| 20436 { // Check that query wins on disagreement. | 20441 { // Check that query wins on disagreement. |
| 20437 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 20442 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| (...skipping 4706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25144 } | 25149 } |
| 25145 | 25150 |
| 25146 TEST(PrivateForApiIsNumber) { | 25151 TEST(PrivateForApiIsNumber) { |
| 25147 LocalContext context; | 25152 LocalContext context; |
| 25148 v8::Isolate* isolate = CcTest::isolate(); | 25153 v8::Isolate* isolate = CcTest::isolate(); |
| 25149 v8::HandleScope scope(isolate); | 25154 v8::HandleScope scope(isolate); |
| 25150 | 25155 |
| 25151 // Shouldn't crash. | 25156 // Shouldn't crash. |
| 25152 v8::Private::ForApi(isolate, v8_str("42")); | 25157 v8::Private::ForApi(isolate, v8_str("42")); |
| 25153 } | 25158 } |
| OLD | NEW |