diff options
author | 2023-06-29 23:36:18 -0400 | |
---|---|---|
committer | 2023-06-29 20:36:18 -0700 | |
commit | b9460087e391c454f323390a42902a3ed024c8bc (patch) | |
tree | d271cce864ac8f3a728f8335d5f9952df0a4a1fb /src/bun.js/bindings/JSReadableState.cpp | |
parent | c42a00f9df7423e60a23a1194731ca7c85a7d16f (diff) | |
download | bun-b9460087e391c454f323390a42902a3ed024c8bc.tar.gz bun-b9460087e391c454f323390a42902a3ed024c8bc.tar.zst bun-b9460087e391c454f323390a42902a3ed024c8bc.zip |
Fixes `node:http` and `node:stream` so `ytdl-core` works. (#3452)
* fix crash in readablestate
* make node:https request+get actually use https
* use a native readablestream in IncomingMessage
* tweaks
* fix abort crash
* emit close by default
* remove abort. this isnt a real function
* add validate functions, fixup some other requested changes. not done yet
* Update WebCoreJSBuiltins.cpp
* Update JSReadableState.cpp
* Add some missing exports
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/JSReadableState.cpp')
-rw-r--r-- | src/bun.js/bindings/JSReadableState.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bun.js/bindings/JSReadableState.cpp b/src/bun.js/bindings/JSReadableState.cpp index 8a4ee746b..1f3a36def 100644 --- a/src/bun.js/bindings/JSReadableState.cpp +++ b/src/bun.js/bindings/JSReadableState.cpp @@ -29,7 +29,7 @@ int64_t getHighWaterMark(JSC::VM& vm, JSC::JSGlobalObject* globalObject, bool is highWaterMarkVal = options->getIfPropertyExists(globalObject, JSC::Identifier::fromString(vm, "readableObjectMode"_s)); } - if (highWaterMarkVal && !highWaterMarkVal.isUndefinedOrNull()) { + if (highWaterMarkVal && highWaterMarkVal.isNumber()) { return highWaterMarkVal.toInt32(globalObject); } } @@ -72,6 +72,9 @@ void JSReadableState::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj JSC::JSValue autoDestroyVal = options->getIfPropertyExists(globalObject, JSC::Identifier::fromString(vm, "autoDestroy"_s)); if (!autoDestroyVal || autoDestroyVal.toBoolean(globalObject)) setBool(JSReadableState::Mask::autoDestroy, true); + } else { + setBool(JSReadableState::Mask::emitClose, true); + setBool(JSReadableState::Mask::autoDestroy, true); } // Indicates whether the stream has finished destroying. |