aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSReadableState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/JSReadableState.cpp')
-rw-r--r--src/bun.js/bindings/JSReadableState.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/bun.js/bindings/JSReadableState.cpp b/src/bun.js/bindings/JSReadableState.cpp
index 682e681f4..5b645e274 100644
--- a/src/bun.js/bindings/JSReadableState.cpp
+++ b/src/bun.js/bindings/JSReadableState.cpp
@@ -108,6 +108,12 @@ void JSReadableState::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj
m_encoding.set(vm, this, JSC::jsNull());
}
}
+
+ // ReadableState.constructed is set to false during construction when a _construct method is implemented
+ // this is here so that the ReadableState behavior tracks the behavior in node, and that calling Readable.read
+ // will work when we return early from construct because there is no Readable._construct implemented
+ // See: https://github.com/nodejs/node/blob/main/lib/internal/streams/readable.js
+ setBool(JSReadableState::Mask::constructed, true);
}
const JSC::ClassInfo JSReadableState::s_info = { "ReadableState"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableState) };
@@ -305,9 +311,12 @@ JSReadableState_NULLABLE_BOOLEAN_GETTER_SETTER(paused)
#undef JSReadableState_JSVALUE_GETTER_SETTER
-#define JSReadableState_GETTER_SETTER_HASH_TABLE_VALUE(NAME) \
- { \
-#NAME ""_s, static_cast < unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, jsReadableState_##NAME, setJSReadableState_##NAME } \
+#define JSReadableState_GETTER_SETTER_HASH_TABLE_VALUE(NAME) \
+ { \
+#NAME ""_s, static_cast < unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, \
+ { \
+ HashTableValue::GetterSetterType, jsReadableState_##NAME, setJSReadableState_##NAME \
+ } \
}
/* Hash table for prototype */