OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "include/v8.h" | 7 #include "include/v8.h" |
8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 v8::FunctionTemplate::New(isolate(), Constructor); | 52 v8::FunctionTemplate::New(isolate(), Constructor); |
53 constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( | 53 constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( |
54 AccessCheck, v8::NamedPropertyHandlerConfiguration(NamedGetter), | 54 AccessCheck, v8::NamedPropertyHandlerConfiguration(NamedGetter), |
55 v8::IndexedPropertyHandlerConfiguration()); | 55 v8::IndexedPropertyHandlerConfiguration()); |
56 | 56 |
57 v8::Local<v8::Object> remote_object = | 57 v8::Local<v8::Object> remote_object = |
58 constructor_template->NewRemoteInstance().ToLocalChecked(); | 58 constructor_template->NewRemoteInstance().ToLocalChecked(); |
59 EXPECT_TRUE(remote_object->CreationContext().IsEmpty()); | 59 EXPECT_TRUE(remote_object->CreationContext().IsEmpty()); |
60 } | 60 } |
61 | 61 |
| 62 TEST_F(RemoteObjectTest, RemoteContextHasInstance) { |
| 63 v8::Local<v8::FunctionTemplate> parent_template = |
| 64 v8::FunctionTemplate::New(isolate(), Constructor); |
| 65 |
| 66 v8::Local<v8::FunctionTemplate> constructor_template = |
| 67 v8::FunctionTemplate::New(isolate(), Constructor); |
| 68 constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( |
| 69 AccessCheck, v8::NamedPropertyHandlerConfiguration(NamedGetter), |
| 70 v8::IndexedPropertyHandlerConfiguration()); |
| 71 constructor_template->Inherit(parent_template); |
| 72 |
| 73 v8::Local<v8::Object> remote_context = |
| 74 v8::Context::NewRemoteContext(isolate(), |
| 75 constructor_template->InstanceTemplate()) |
| 76 .ToLocalChecked(); |
| 77 EXPECT_TRUE(parent_template->HasInstance(remote_context)); |
| 78 EXPECT_TRUE(constructor_template->HasInstance(remote_context)); |
| 79 } |
| 80 |
62 } // namespace v8 | 81 } // namespace v8 |
OLD | NEW |