@@ -648,12 +648,10 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& info)
648
648
/* }}} */
649
649
650
650
/* This method handles named property and method get/set/query/delete. */
651
- template <typename T>
652
- v8::Local<v8::Value> v8js_named_property_callback (v8::Local<v8::Name> property_name, const v8::PropertyCallbackInfo<T> &info, property_op_t callback_type, v8::Local<v8::Value> set_value) /* {{{ */
651
+ v8::Local<v8::Value> v8js_named_property_callback (v8::Isolate *isolate, v8::Local<v8::Object> self, v8::Local<v8::Name> property_name, property_op_t callback_type, v8::Local<v8::Value> set_value) /* {{{ */
653
652
{
654
653
v8::Local<v8::String> property = v8::Local<v8::String>::Cast (property_name);
655
654
656
- v8::Isolate *isolate = info.GetIsolate ();
657
655
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext ();
658
656
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData (0 );
659
657
v8::String::Utf8Value cstr (isolate, property);
@@ -662,7 +660,6 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
662
660
char *lower = estrndup (name, name_len);
663
661
zend_string *method_name;
664
662
665
- v8::Local<v8::Object> self = info.Holder ();
666
663
v8::Local<v8::Value> ret_value;
667
664
v8::Local<v8::Function> cb;
668
665
@@ -860,44 +857,58 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
860
857
}
861
858
/* }}} */
862
859
863
- static void v8js_named_property_getter (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value> &info) /* {{{ */
860
+ static v8::Intercepted v8js_named_property_getter (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value> &info) /* {{{ */
864
861
{
865
- info.GetReturnValue ().Set (v8js_named_property_callback (property, info, V8JS_PROP_GETTER));
862
+ v8::Local<v8::Value> r = v8js_named_property_callback (info.GetIsolate (), info.Holder (), property, V8JS_PROP_GETTER);
863
+
864
+ if (r.IsEmpty ()) {
865
+ return v8::Intercepted::kNo ;
866
+ } else {
867
+ info.GetReturnValue ().Set (r);
868
+ return v8::Intercepted::kYes ;
869
+ }
866
870
}
867
871
/* }}} */
868
872
869
- static void v8js_named_property_setter (v8::Local<v8::Name> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value > &info) /* {{{ */
873
+ static v8::Intercepted v8js_named_property_setter (v8::Local<v8::Name> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void > &info) /* {{{ */
870
874
{
871
- info.GetReturnValue ().Set (v8js_named_property_callback (property, info, V8JS_PROP_SETTER, value));
875
+ v8::Local<v8::Value> r = v8js_named_property_callback (info.GetIsolate (), info.Holder (), property, V8JS_PROP_SETTER, value);
876
+ return r.IsEmpty () ? v8::Intercepted::kNo : v8::Intercepted::kYes ;
872
877
}
873
878
/* }}} */
874
879
875
- static void v8js_named_property_query (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Integer> &info) /* {{{ */
880
+ static v8::Intercepted v8js_named_property_query (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Integer> &info) /* {{{ */
876
881
{
877
- v8::Local<v8::Value> r = v8js_named_property_callback (property , info, V8JS_PROP_QUERY);
882
+ v8::Local<v8::Value> r = v8js_named_property_callback (info. GetIsolate () , info. Holder (), property , V8JS_PROP_QUERY);
878
883
if (r.IsEmpty ()) {
879
- return ;
884
+ return v8::Intercepted:: kNo ;
880
885
}
881
886
882
887
v8::Isolate *isolate = info.GetIsolate ();
883
888
v8::MaybeLocal<v8::Integer> value = r->ToInteger (isolate->GetEnteredOrMicrotaskContext ());
884
- if (!value.IsEmpty ()) {
889
+ if (value.IsEmpty ()) {
890
+ return v8::Intercepted::kNo ;
891
+ } else {
885
892
info.GetReturnValue ().Set (value.ToLocalChecked ());
893
+ return v8::Intercepted::kYes ;
886
894
}
887
895
}
888
896
/* }}} */
889
897
890
- static void v8js_named_property_deleter (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Boolean > &info) /* {{{ */
898
+ static v8::Intercepted v8js_named_property_deleter (v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Boolean > &info) /* {{{ */
891
899
{
892
- v8::Local<v8::Value> r = v8js_named_property_callback (property , info, V8JS_PROP_DELETER);
900
+ v8::Local<v8::Value> r = v8js_named_property_callback (info. GetIsolate () , info. Holder (), property , V8JS_PROP_DELETER);
893
901
if (r.IsEmpty ()) {
894
- return ;
902
+ return v8::Intercepted:: kNo ;
895
903
}
896
904
897
905
v8::Isolate *isolate = info.GetIsolate ();
898
906
v8::Local<v8::Boolean > value = r->ToBoolean (isolate);
899
- if (!value.IsEmpty ()) {
907
+ if (value.IsEmpty ()) {
908
+ return v8::Intercepted::kNo ;
909
+ } else {
900
910
info.GetReturnValue ().Set (value);
911
+ return v8::Intercepted::kYes ;
901
912
}
902
913
}
903
914
/* }}} */
@@ -940,7 +951,7 @@ static v8::MaybeLocal<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_cl
940
951
/* We'll free persist_tpl_ when template_cache is destroyed */
941
952
942
953
v8::Local<v8::ObjectTemplate> inst_tpl = new_tpl->InstanceTemplate ();
943
- v8::GenericNamedPropertyGetterCallback getter = v8js_named_property_getter;
954
+ v8::NamedPropertyGetterCallback getter = v8js_named_property_getter;
944
955
v8::GenericNamedPropertyEnumeratorCallback enumerator = v8js_named_property_enumerator;
945
956
946
957
/* Check for ArrayAccess object */
@@ -958,11 +969,12 @@ static v8::MaybeLocal<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_cl
958
969
}
959
970
960
971
if (has_array_access && has_countable) {
961
- inst_tpl->SetIndexedPropertyHandler (v8js_array_access_getter,
962
- v8js_array_access_setter,
963
- v8js_array_access_query,
964
- v8js_array_access_deleter,
965
- v8js_array_access_enumerator);
972
+ inst_tpl->SetHandler (
973
+ v8::IndexedPropertyHandlerConfiguration (v8js_array_access_getter,
974
+ v8js_array_access_setter,
975
+ v8js_array_access_query,
976
+ v8js_array_access_deleter,
977
+ v8js_array_access_enumerator));
966
978
967
979
/* Switch to special ArrayAccess getter, which falls back to
968
980
* v8js_named_property_getter, but possibly bridges the
0 commit comments