| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 i::HandleScope scope(isolate); | 1524 i::HandleScope scope(isolate); |
| 1525 auto cons = EnsureConstructor(isolate, this); | 1525 auto cons = EnsureConstructor(isolate, this); |
| 1526 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallback"); | 1526 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallback"); |
| 1527 | 1527 |
| 1528 i::Handle<i::Struct> struct_info = | 1528 i::Handle<i::Struct> struct_info = |
| 1529 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); | 1529 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); |
| 1530 i::Handle<i::AccessCheckInfo> info = | 1530 i::Handle<i::AccessCheckInfo> info = |
| 1531 i::Handle<i::AccessCheckInfo>::cast(struct_info); | 1531 i::Handle<i::AccessCheckInfo>::cast(struct_info); |
| 1532 | 1532 |
| 1533 SET_FIELD_WRAPPED(info, set_callback, callback); | 1533 SET_FIELD_WRAPPED(info, set_callback, callback); |
| 1534 SET_FIELD_WRAPPED(info, set_named_callback, nullptr); | |
| 1535 SET_FIELD_WRAPPED(info, set_indexed_callback, nullptr); | |
| 1536 | 1534 |
| 1537 if (data.IsEmpty()) { | 1535 if (data.IsEmpty()) { |
| 1538 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1536 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1539 } | 1537 } |
| 1540 info->set_data(*Utils::OpenHandle(*data)); | 1538 info->set_data(*Utils::OpenHandle(*data)); |
| 1541 | 1539 |
| 1542 cons->set_access_check_info(*info); | 1540 cons->set_access_check_info(*info); |
| 1543 cons->set_needs_access_check(true); | 1541 cons->set_needs_access_check(true); |
| 1544 } | 1542 } |
| 1545 | 1543 |
| 1546 void ObjectTemplate::SetAccessCheckCallback( | |
| 1547 DeprecatedAccessCheckCallback callback, Local<Value> data) { | |
| 1548 SetAccessCheckCallback(reinterpret_cast<AccessCheckCallback>(callback), data); | |
| 1549 } | |
| 1550 | |
| 1551 void ObjectTemplate::SetAccessCheckCallbacks( | |
| 1552 NamedSecurityCallback named_callback, | |
| 1553 IndexedSecurityCallback indexed_callback, Local<Value> data) { | |
| 1554 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
| 1555 ENTER_V8(isolate); | |
| 1556 i::HandleScope scope(isolate); | |
| 1557 auto cons = EnsureConstructor(isolate, this); | |
| 1558 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallbacks"); | |
| 1559 | |
| 1560 i::Handle<i::Struct> struct_info = | |
| 1561 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); | |
| 1562 i::Handle<i::AccessCheckInfo> info = | |
| 1563 i::Handle<i::AccessCheckInfo>::cast(struct_info); | |
| 1564 | |
| 1565 SET_FIELD_WRAPPED(info, set_callback, nullptr); | |
| 1566 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); | |
| 1567 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); | |
| 1568 | |
| 1569 if (data.IsEmpty()) { | |
| 1570 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | |
| 1571 } | |
| 1572 info->set_data(*Utils::OpenHandle(*data)); | |
| 1573 | |
| 1574 cons->set_access_check_info(*info); | |
| 1575 cons->set_needs_access_check(true); | |
| 1576 } | |
| 1577 | |
| 1578 | |
| 1579 void ObjectTemplate::SetHandler( | 1544 void ObjectTemplate::SetHandler( |
| 1580 const IndexedPropertyHandlerConfiguration& config) { | 1545 const IndexedPropertyHandlerConfiguration& config) { |
| 1581 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1546 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1582 ENTER_V8(isolate); | 1547 ENTER_V8(isolate); |
| 1583 i::HandleScope scope(isolate); | 1548 i::HandleScope scope(isolate); |
| 1584 auto cons = EnsureConstructor(isolate, this); | 1549 auto cons = EnsureConstructor(isolate, this); |
| 1585 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); | 1550 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); |
| 1586 auto obj = i::Handle<i::InterceptorInfo>::cast( | 1551 auto obj = i::Handle<i::InterceptorInfo>::cast( |
| 1587 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); | 1552 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); |
| 1588 obj->set_flags(0); | 1553 obj->set_flags(0); |
| (...skipping 7220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8809 Address callback_address = | 8774 Address callback_address = |
| 8810 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8775 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8811 VMState<EXTERNAL> state(isolate); | 8776 VMState<EXTERNAL> state(isolate); |
| 8812 ExternalCallbackScope call_scope(isolate, callback_address); | 8777 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8813 callback(info); | 8778 callback(info); |
| 8814 } | 8779 } |
| 8815 | 8780 |
| 8816 | 8781 |
| 8817 } // namespace internal | 8782 } // namespace internal |
| 8818 } // namespace v8 | 8783 } // namespace v8 |
| OLD | NEW |