From d1344c56aeb9af794a14529afb5892435855eba4 Mon Sep 17 00:00:00 2001 From: Victor Gomes Date: Mon, 3 Jun 2024 13:46:55 +0200 Subject: [PATCH] Define XxxStream.prototype.onread as an accessor in JavaScript sense (#183) Previously is was defined via soon-to-be-deprecated `v8::ObjectTemplate::SetAccessor(..)` which used to call setter even for property stores via stream object. The replacement V8 Api `v8::ObjectTemplate::SetNativeDataProperty(..)` defines a properly behaving data property and thus a store to a stream object will not trigger the "onread" setter callback. In order to preserve the desired behavior of storing the value in the receiver's internal field the "onread" property should be defined as a proper JavaScript accessor. # Conflicts: # src/base_object-inl.h --- src/base_object-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base_object-inl.h b/src/base_object-inl.h index 61f30b3cfbdb0f..6542ebeff3a029 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -140,8 +140,8 @@ void BaseObject::InternalFieldGet( template void BaseObject::InternalFieldSet( const v8::FunctionCallbackInfo& args) { - v8::Local value = args[0]; // This could be e.g. value->IsFunction(). + v8::Local value = args[0]; CHECK(((*value)->*typecheck)()); args.This()->SetInternalField(Field, value); }