Skip to content

Commit

Permalink
Define XxxStream.prototype.onread as an accessor in JavaScript sense (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
victorgomes committed Nov 18, 2024
1 parent 31d762e commit d1344c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/base_object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ void BaseObject::InternalFieldGet(
template <int Field, bool (v8::Value::*typecheck)() const>
void BaseObject::InternalFieldSet(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Local<v8::Value> value = args[0];
// This could be e.g. value->IsFunction().
v8::Local<v8::Value> value = args[0];
CHECK(((*value)->*typecheck)());
args.This()->SetInternalField(Field, value);
}
Expand Down

0 comments on commit d1344c5

Please sign in to comment.