diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/bindings/JSSink.cpp | 441 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSink.h | 879 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSinkLookupTable.h | 54 | ||||
-rw-r--r-- | src/bun.js/bindings/bindings.zig | 17 | ||||
-rw-r--r-- | src/bun.js/bindings/headers-cpp.h | 24 | ||||
-rw-r--r-- | src/bun.js/bindings/headers-handwritten.h | 47 | ||||
-rw-r--r-- | src/bun.js/bindings/headers-replacements.zig | 1 | ||||
-rw-r--r-- | src/bun.js/bindings/headers.h | 52 | ||||
-rw-r--r-- | src/bun.js/bindings/headers.zig | 382 | ||||
-rw-r--r-- | src/bun.js/bindings/webcore/JSEventTargetCustom.cpp | 8 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp | 118 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h | 16 | ||||
-rw-r--r-- | src/bun.js/builtins/js/ReadableStreamInternals.js | 110 | ||||
-rw-r--r-- | src/bun.js/generate-jssink.js | 4 | ||||
-rw-r--r-- | src/bun.js/javascript.zig | 6 | ||||
-rw-r--r-- | src/bun.js/webcore/streams.zig | 134 | ||||
-rw-r--r-- | src/cli/test_command.zig | 4 | ||||
-rw-r--r-- | src/deps/uws.zig | 51 |
18 files changed, 1196 insertions, 1152 deletions
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp index 65db7de4b..21b807c7f 100644 --- a/src/bun.js/bindings/JSSink.cpp +++ b/src/bun.js/bindings/JSSink.cpp @@ -1,6 +1,6 @@ // AUTO-GENERATED FILE. DO NOT EDIT. -// Generated by 'make generate-sink' at 2022-07-01T08:27:39.340Z +// Generated by 'make generate-sink' at 2022-07-02T06:06:00.513Z // To regenerate this file, run: // // make generate-sink @@ -54,12 +54,18 @@ #include "JavaScriptCore/Weak.h" #include "JavaScriptCore/WeakInlines.h" + + namespace WebCore { using namespace JSC; -JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ + + + +JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -80,10 +86,12 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic onClose = JSC::jsUndefined(); } - JSC::JSFunction* onPullFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onPull); - JSC::JSFunction* onCloseFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onClose); + JSC::JSFunction *onPullFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onPull); + JSC::JSFunction *onCloseFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onClose); + + - if (WebCore::JSReadableArrayBufferSinkController* ArrayBufferSinkController = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(callFrame->thisValue())) { + if (WebCore::JSReadableArrayBufferSinkController* ArrayBufferSinkController = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(callFrame->thisValue())) { if (ArrayBufferSinkController->wrapped() == nullptr) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); return JSC::JSValue::encode(JSC::jsUndefined()); @@ -92,6 +100,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic ArrayBufferSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); } + else if (WebCore::JSReadableHTTPResponseSinkController* HTTPResponseSinkController = JSC::jsDynamicCast<WebCore::JSReadableHTTPResponseSinkController*>(callFrame->thisValue())) { if (HTTPResponseSinkController->wrapped() == nullptr) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); @@ -101,6 +110,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic HTTPResponseSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); } + else if (WebCore::JSReadableHTTPSResponseSinkController* HTTPSResponseSinkController = JSC::jsDynamicCast<WebCore::JSReadableHTTPSResponseSinkController*>(callFrame->thisValue())) { if (HTTPSResponseSinkController->wrapped() == nullptr) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); @@ -126,10 +136,11 @@ JSC_DEFINE_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject * return JSC::JSValue::encode(globalObject->ArrayBufferSink()); } + JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -139,7 +150,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlo return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -150,9 +161,9 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlo } JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -162,7 +173,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end, (JSC::JSGloba return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -171,10 +182,11 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__end, (JSC::JSGloba return ArrayBufferSink__endWithSink(ptr, lexicalGlobalObject); } + JSC_DECLARE_HOST_FUNCTION(ArrayBufferSink__doClose); -JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -184,7 +196,7 @@ JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexica return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = sink->wrapped(); + void *ptr = sink->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -194,6 +206,8 @@ JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexica return JSC::JSValue::encode(JSC::jsUndefined()); } + + JSC_DEFINE_CUSTOM_GETTER(functionHTTPResponseSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { auto& vm = lexicalGlobalObject->vm(); @@ -202,10 +216,11 @@ JSC_DEFINE_CUSTOM_GETTER(functionHTTPResponseSink__getter, (JSC::JSGlobalObject return JSC::JSValue::encode(globalObject->HTTPResponseSink()); } + JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -215,7 +230,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close, (JSC::JSGl return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -226,9 +241,9 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__close, (JSC::JSGl } JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -238,7 +253,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end, (JSC::JSGlob return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -247,10 +262,11 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPResponseSinkController__end, (JSC::JSGlob return HTTPResponseSink__endWithSink(ptr, lexicalGlobalObject); } + JSC_DECLARE_HOST_FUNCTION(HTTPResponseSink__doClose); -JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -260,7 +276,7 @@ JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__doClose, (JSC::JSGlobalObject * lexic return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = sink->wrapped(); + void *ptr = sink->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -270,6 +286,8 @@ JSC_DEFINE_HOST_FUNCTION(HTTPResponseSink__doClose, (JSC::JSGlobalObject * lexic return JSC::JSValue::encode(JSC::jsUndefined()); } + + JSC_DEFINE_CUSTOM_GETTER(functionHTTPSResponseSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName)) { auto& vm = lexicalGlobalObject->vm(); @@ -278,10 +296,11 @@ JSC_DEFINE_CUSTOM_GETTER(functionHTTPSResponseSink__getter, (JSC::JSGlobalObject return JSC::JSValue::encode(globalObject->HTTPSResponseSink()); } + JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -291,7 +310,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close, (JSC::JSG return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -302,9 +321,9 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__close, (JSC::JSG } JSC_DECLARE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end); -JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -314,7 +333,7 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end, (JSC::JSGlo return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = controller->wrapped(); + void *ptr = controller->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -323,10 +342,11 @@ JSC_DEFINE_HOST_FUNCTION(JSReadableHTTPSResponseSinkController__end, (JSC::JSGlo return HTTPSResponseSink__endWithSink(ptr, lexicalGlobalObject); } + JSC_DECLARE_HOST_FUNCTION(HTTPSResponseSink__doClose); -JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame)) { - + auto& vm = lexicalGlobalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); @@ -336,7 +356,7 @@ JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__doClose, (JSC::JSGlobalObject * lexi return JSC::JSValue::encode(JSC::jsUndefined()); } - void* ptr = sink->wrapped(); + void *ptr = sink->wrapped(); if (ptr == nullptr) { return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -346,71 +366,81 @@ JSC_DEFINE_HOST_FUNCTION(HTTPSResponseSink__doClose, (JSC::JSGlobalObject * lexi return JSC::JSValue::encode(JSC::jsUndefined()); } -#include "JSSinkLookupTable.h" + +#include "JSSinkLookupTable.h" + /* Source for JSArrayBufferSinkPrototypeTableValues.lut.h @begin JSArrayBufferSinkPrototypeTable close ArrayBufferSink__doClose ReadOnly|DontDelete|Function 0 - drain ArrayBufferSink__drain ReadOnly|DontDelete|Function 1 + flush ArrayBufferSink__flush ReadOnly|DontDelete|Function 1 end ArrayBufferSink__end ReadOnly|DontDelete|Function 0 start ArrayBufferSink__start ReadOnly|DontDelete|Function 1 write ArrayBufferSink__write ReadOnly|DontDelete|Function 1 - + @end */ + /* Source for JSReadableArrayBufferSinkControllerPrototypeTableValues.lut.h @begin JSReadableArrayBufferSinkControllerPrototypeTable close JSReadableArrayBufferSinkController__close ReadOnly|DontDelete|Function 0 - drain ArrayBufferSink__drain ReadOnly|DontDelete|Function 1 + flush ArrayBufferSink__flush ReadOnly|DontDelete|Function 1 end JSReadableArrayBufferSinkController__end ReadOnly|DontDelete|Function 0 start ArrayBufferSink__start ReadOnly|DontDelete|Function 1 write ArrayBufferSink__write ReadOnly|DontDelete|Function 1 @end */ + /* Source for JSHTTPResponseSinkPrototypeTableValues.lut.h @begin JSHTTPResponseSinkPrototypeTable close HTTPResponseSink__doClose ReadOnly|DontDelete|Function 0 - drain HTTPResponseSink__drain ReadOnly|DontDelete|Function 1 + flush HTTPResponseSink__flush ReadOnly|DontDelete|Function 1 end HTTPResponseSink__end ReadOnly|DontDelete|Function 0 start HTTPResponseSink__start ReadOnly|DontDelete|Function 1 write HTTPResponseSink__write ReadOnly|DontDelete|Function 1 - + @end */ + /* Source for JSReadableHTTPResponseSinkControllerPrototypeTableValues.lut.h @begin JSReadableHTTPResponseSinkControllerPrototypeTable close JSReadableHTTPResponseSinkController__close ReadOnly|DontDelete|Function 0 - drain HTTPResponseSink__drain ReadOnly|DontDelete|Function 1 + flush HTTPResponseSink__flush ReadOnly|DontDelete|Function 1 end JSReadableHTTPResponseSinkController__end ReadOnly|DontDelete|Function 0 start HTTPResponseSink__start ReadOnly|DontDelete|Function 1 write HTTPResponseSink__write ReadOnly|DontDelete|Function 1 @end */ + /* Source for JSHTTPSResponseSinkPrototypeTableValues.lut.h @begin JSHTTPSResponseSinkPrototypeTable close HTTPSResponseSink__doClose ReadOnly|DontDelete|Function 0 - drain HTTPSResponseSink__drain ReadOnly|DontDelete|Function 1 + flush HTTPSResponseSink__flush ReadOnly|DontDelete|Function 1 end HTTPSResponseSink__end ReadOnly|DontDelete|Function 0 start HTTPSResponseSink__start ReadOnly|DontDelete|Function 1 write HTTPSResponseSink__write ReadOnly|DontDelete|Function 1 - + @end */ + /* Source for JSReadableHTTPSResponseSinkControllerPrototypeTableValues.lut.h @begin JSReadableHTTPSResponseSinkControllerPrototypeTable close JSReadableHTTPSResponseSinkController__close ReadOnly|DontDelete|Function 0 - drain HTTPSResponseSink__drain ReadOnly|DontDelete|Function 1 + flush HTTPSResponseSink__flush ReadOnly|DontDelete|Function 1 end JSReadableHTTPSResponseSinkController__end ReadOnly|DontDelete|Function 0 start HTTPSResponseSink__start ReadOnly|DontDelete|Function 1 write HTTPSResponseSink__write ReadOnly|DontDelete|Function 1 @end */ + + + #pragma mark - ArrayBufferSink class JSArrayBufferSinkPrototype final : public JSC::JSNonFinalObject { @@ -446,41 +476,42 @@ private: STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, JSArrayBufferSinkPrototype::Base); class JSReadableArrayBufferSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableArrayBufferSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableArrayBufferSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerPrototype>(vm)) JSReadableArrayBufferSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableArrayBufferSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base); + public: + using Base = JSC::JSNonFinalObject; + + static JSReadableArrayBufferSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSReadableArrayBufferSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerPrototype>(vm)) JSReadableArrayBufferSinkControllerPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSReadableArrayBufferSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base); const ClassInfo JSArrayBufferSinkPrototype::s_info = { "ArrayBufferSink"_s, &Base::s_info, &JSArrayBufferSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkPrototype) }; const ClassInfo JSArrayBufferSink::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSink) }; const ClassInfo JSArrayBufferSinkConstructor::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkConstructor) }; + const ClassInfo JSReadableArrayBufferSinkControllerPrototype::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, &JSReadableArrayBufferSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerPrototype) }; const ClassInfo JSReadableArrayBufferSinkController::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkController) }; @@ -491,6 +522,7 @@ JSArrayBufferSink::~JSArrayBufferSink() } } + JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController() { if (m_sinkPtr) { @@ -508,6 +540,8 @@ JSObject* JSReadableArrayBufferSinkController::createPrototype(VM& vm, JSDOMGlob return JSReadableArrayBufferSinkControllerPrototype::create(vm, &globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); } + + JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) { JSArrayBufferSinkConstructor* ptr = new (NotNull, JSC::allocateCell<JSArrayBufferSinkConstructor>(vm)) JSArrayBufferSinkConstructor(vm, structure, ArrayBufferSink__construct); @@ -536,11 +570,11 @@ void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* g initializeProperties(vm, globalObject, prototype); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { return ArrayBufferSink__construct(globalObject, callFrame); } + void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) { putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); @@ -577,6 +611,7 @@ void JSReadableArrayBufferSinkController::finishCreation(VM& vm) ASSERT(inherits(info())); } + void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { auto* thisObject = jsCast<JSArrayBufferSink*>(cell); @@ -599,6 +634,7 @@ void JSReadableArrayBufferSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer Base::analyzeHeap(cell, analyzer); } + template<typename Visitor> void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) { @@ -612,8 +648,8 @@ void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visito DEFINE_VISIT_CHILDREN(JSReadableArrayBufferSinkController); -void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) -{ + +void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); this->m_onClose.set(globalObject->vm(), this, onClose); @@ -624,11 +660,14 @@ void JSArrayBufferSink::destroy(JSCell* cell) static_cast<JSArrayBufferSink*>(cell)->JSArrayBufferSink::~JSArrayBufferSink(); } + void JSReadableArrayBufferSinkController::destroy(JSCell* cell) { static_cast<JSReadableArrayBufferSinkController*>(cell)->JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController(); } + + #pragma mark - HTTPResponseSink class JSHTTPResponseSinkPrototype final : public JSC::JSNonFinalObject { @@ -664,41 +703,42 @@ private: STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPResponseSinkPrototype, JSHTTPResponseSinkPrototype::Base); class JSReadableHTTPResponseSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableHTTPResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableHTTPResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableHTTPResponseSinkControllerPrototype>(vm)) JSReadableHTTPResponseSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableHTTPResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPResponseSinkControllerPrototype, JSReadableHTTPResponseSinkControllerPrototype::Base); + public: + using Base = JSC::JSNonFinalObject; + + static JSReadableHTTPResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSReadableHTTPResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableHTTPResponseSinkControllerPrototype>(vm)) JSReadableHTTPResponseSinkControllerPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSReadableHTTPResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPResponseSinkControllerPrototype, JSReadableHTTPResponseSinkControllerPrototype::Base); const ClassInfo JSHTTPResponseSinkPrototype::s_info = { "HTTPResponseSink"_s, &Base::s_info, &JSHTTPResponseSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSinkPrototype) }; const ClassInfo JSHTTPResponseSink::s_info = { "HTTPResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSink) }; const ClassInfo JSHTTPResponseSinkConstructor::s_info = { "HTTPResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPResponseSinkConstructor) }; + const ClassInfo JSReadableHTTPResponseSinkControllerPrototype::s_info = { "ReadableHTTPResponseSinkController"_s, &Base::s_info, &JSReadableHTTPResponseSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPResponseSinkControllerPrototype) }; const ClassInfo JSReadableHTTPResponseSinkController::s_info = { "ReadableHTTPResponseSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPResponseSinkController) }; @@ -709,6 +749,7 @@ JSHTTPResponseSink::~JSHTTPResponseSink() } } + JSReadableHTTPResponseSinkController::~JSReadableHTTPResponseSinkController() { if (m_sinkPtr) { @@ -726,6 +767,8 @@ JSObject* JSReadableHTTPResponseSinkController::createPrototype(VM& vm, JSDOMGlo return JSReadableHTTPResponseSinkControllerPrototype::create(vm, &globalObject, JSReadableHTTPResponseSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); } + + JSHTTPResponseSinkConstructor* JSHTTPResponseSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) { JSHTTPResponseSinkConstructor* ptr = new (NotNull, JSC::allocateCell<JSHTTPResponseSinkConstructor>(vm)) JSHTTPResponseSinkConstructor(vm, structure, HTTPResponseSink__construct); @@ -754,11 +797,11 @@ void JSHTTPResponseSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* initializeProperties(vm, globalObject, prototype); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { return HTTPResponseSink__construct(globalObject, callFrame); } + void JSHTTPResponseSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) { putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); @@ -795,6 +838,7 @@ void JSReadableHTTPResponseSinkController::finishCreation(VM& vm) ASSERT(inherits(info())); } + void JSHTTPResponseSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { auto* thisObject = jsCast<JSHTTPResponseSink*>(cell); @@ -817,6 +861,7 @@ void JSReadableHTTPResponseSinkController::analyzeHeap(JSCell* cell, HeapAnalyze Base::analyzeHeap(cell, analyzer); } + template<typename Visitor> void JSReadableHTTPResponseSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) { @@ -830,8 +875,8 @@ void JSReadableHTTPResponseSinkController::visitChildrenImpl(JSCell* cell, Visit DEFINE_VISIT_CHILDREN(JSReadableHTTPResponseSinkController); -void JSReadableHTTPResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) -{ + +void JSReadableHTTPResponseSinkController::start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); this->m_onClose.set(globalObject->vm(), this, onClose); @@ -842,11 +887,14 @@ void JSHTTPResponseSink::destroy(JSCell* cell) static_cast<JSHTTPResponseSink*>(cell)->JSHTTPResponseSink::~JSHTTPResponseSink(); } + void JSReadableHTTPResponseSinkController::destroy(JSCell* cell) { static_cast<JSReadableHTTPResponseSinkController*>(cell)->JSReadableHTTPResponseSinkController::~JSReadableHTTPResponseSinkController(); } + + #pragma mark - HTTPSResponseSink class JSHTTPSResponseSinkPrototype final : public JSC::JSNonFinalObject { @@ -882,41 +930,42 @@ private: STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSResponseSinkPrototype, JSHTTPSResponseSinkPrototype::Base); class JSReadableHTTPSResponseSinkControllerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSReadableHTTPSResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableHTTPSResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableHTTPSResponseSinkControllerPrototype>(vm)) JSReadableHTTPSResponseSinkControllerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSReadableHTTPSResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPSResponseSinkControllerPrototype, JSReadableHTTPSResponseSinkControllerPrototype::Base); + public: + using Base = JSC::JSNonFinalObject; + + static JSReadableHTTPSResponseSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSReadableHTTPSResponseSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableHTTPSResponseSinkControllerPrototype>(vm)) JSReadableHTTPSResponseSinkControllerPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSReadableHTTPSResponseSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPSResponseSinkControllerPrototype, JSReadableHTTPSResponseSinkControllerPrototype::Base); const ClassInfo JSHTTPSResponseSinkPrototype::s_info = { "HTTPSResponseSink"_s, &Base::s_info, &JSHTTPSResponseSinkPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSinkPrototype) }; const ClassInfo JSHTTPSResponseSink::s_info = { "HTTPSResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSink) }; const ClassInfo JSHTTPSResponseSinkConstructor::s_info = { "HTTPSResponseSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTTPSResponseSinkConstructor) }; + const ClassInfo JSReadableHTTPSResponseSinkControllerPrototype::s_info = { "ReadableHTTPSResponseSinkController"_s, &Base::s_info, &JSReadableHTTPSResponseSinkControllerPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPSResponseSinkControllerPrototype) }; const ClassInfo JSReadableHTTPSResponseSinkController::s_info = { "ReadableHTTPSResponseSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableHTTPSResponseSinkController) }; @@ -927,6 +976,7 @@ JSHTTPSResponseSink::~JSHTTPSResponseSink() } } + JSReadableHTTPSResponseSinkController::~JSReadableHTTPSResponseSinkController() { if (m_sinkPtr) { @@ -944,6 +994,8 @@ JSObject* JSReadableHTTPSResponseSinkController::createPrototype(VM& vm, JSDOMGl return JSReadableHTTPSResponseSinkControllerPrototype::create(vm, &globalObject, JSReadableHTTPSResponseSinkControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); } + + JSHTTPSResponseSinkConstructor* JSHTTPSResponseSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype) { JSHTTPSResponseSinkConstructor* ptr = new (NotNull, JSC::allocateCell<JSHTTPSResponseSinkConstructor>(vm)) JSHTTPSResponseSinkConstructor(vm, structure, HTTPSResponseSink__construct); @@ -972,11 +1024,11 @@ void JSHTTPSResponseSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* initializeProperties(vm, globalObject, prototype); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPSResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) -{ +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSHTTPSResponseSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { return HTTPSResponseSink__construct(globalObject, callFrame); } + void JSHTTPSResponseSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype) { putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); @@ -1013,6 +1065,7 @@ void JSReadableHTTPSResponseSinkController::finishCreation(VM& vm) ASSERT(inherits(info())); } + void JSHTTPSResponseSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { auto* thisObject = jsCast<JSHTTPSResponseSink*>(cell); @@ -1035,6 +1088,7 @@ void JSReadableHTTPSResponseSinkController::analyzeHeap(JSCell* cell, HeapAnalyz Base::analyzeHeap(cell, analyzer); } + template<typename Visitor> void JSReadableHTTPSResponseSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor) { @@ -1048,8 +1102,8 @@ void JSReadableHTTPSResponseSinkController::visitChildrenImpl(JSCell* cell, Visi DEFINE_VISIT_CHILDREN(JSReadableHTTPSResponseSinkController); -void JSReadableHTTPSResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) -{ + +void JSReadableHTTPSResponseSinkController::start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); this->m_onClose.set(globalObject->vm(), this, onClose); @@ -1060,15 +1114,18 @@ void JSHTTPSResponseSink::destroy(JSCell* cell) static_cast<JSHTTPSResponseSink*>(cell)->JSHTTPSResponseSink::~JSHTTPSResponseSink(); } + void JSReadableHTTPSResponseSinkController::destroy(JSCell* cell) { static_cast<JSReadableHTTPSResponseSinkController*>(cell)->JSReadableHTTPSResponseSinkController::~JSReadableHTTPSResponseSinkController(); } -JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) -{ - switch (sinkID) { + + JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) + { + switch (sinkID) { + case ArrayBufferSink: return JSArrayBufferSinkPrototype::create(vm, globalObject, JSArrayBufferSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); @@ -1078,29 +1135,30 @@ JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, case HTTPSResponseSink: return JSHTTPSResponseSinkPrototype::create(vm, globalObject, JSHTTPSResponseSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - default: - RELEASE_ASSERT_NOT_REACHED(); +default: + RELEASE_ASSERT_NOT_REACHED(); } } JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID) { switch (sinkID) { + + case ArrayBufferSink: + return JSReadableArrayBufferSinkControllerPrototype::create(vm, globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - case ArrayBufferSink: - return JSReadableArrayBufferSinkControllerPrototype::create(vm, globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - - case HTTPResponseSink: - return JSReadableHTTPResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + case HTTPResponseSink: + return JSReadableHTTPResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - case HTTPSResponseSink: - return JSReadableHTTPSResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPSResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + case HTTPSResponseSink: + return JSReadableHTTPSResponseSinkControllerPrototype::create(vm, globalObject, JSReadableHTTPSResponseSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); - default: - RELEASE_ASSERT_NOT_REACHED(); - } +default: + RELEASE_ASSERT_NOT_REACHED(); + } } } // namespace WebCore + extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) { auto& vm = arg0->vm(); @@ -1128,6 +1186,7 @@ extern "C" void ArrayBufferSink__detachPtr(JSC__JSValue JSValue0) sink->detach(); return; } + if (auto* controller = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(JSValue0))) { controller->detach(); @@ -1135,18 +1194,18 @@ extern "C" void ArrayBufferSink__detachPtr(JSC__JSValue JSValue0) } } -extern "C" JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) +extern "C" JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void **controllerValue) { auto& vm = arg0->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0); auto clientData = WebCore::clientData(vm); - JSC::JSObject* readableStream = JSC::JSValue::decode(stream).getObject(); + JSC::JSObject *readableStream = JSC::JSValue::decode(stream).getObject(); auto scope = DECLARE_CATCH_SCOPE(vm); JSC::Structure* structure = WebCore::getDOMStructure<WebCore::JSReadableArrayBufferSinkController>(vm, *globalObject); - WebCore::JSReadableArrayBufferSinkController* controller = WebCore::JSReadableArrayBufferSinkController::create(vm, globalObject, structure, sinkPtr); + WebCore::JSReadableArrayBufferSinkController *controller = WebCore::JSReadableArrayBufferSinkController::create(vm, globalObject, structure, sinkPtr); *controllerValue = reinterpret_cast<void*>(JSC::JSValue::encode(controller)); - JSC::JSObject* function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); + JSC::JSObject *function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(JSC::JSValue::decode(stream)); @@ -1163,10 +1222,10 @@ extern "C" void ArrayBufferSink__onReady(JSC__JSValue controllerValue, JSC__JSVa { WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); + JSC::JSFunction *function = controller->m_onPull.get(); if (function == nullptr) return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; @@ -1179,18 +1238,19 @@ extern "C" void ArrayBufferSink__onReady(JSC__JSValue controllerValue, JSC__JSVa extern "C" void ArrayBufferSink__onStart(JSC__JSValue controllerValue) { + } extern "C" void ArrayBufferSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) { WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); + JSC::JSFunction *function = controller->m_onClose.get(); if (function == nullptr) return; // only call close once controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; @@ -1199,6 +1259,7 @@ extern "C" void ArrayBufferSink__onClose(JSC__JSValue controllerValue, JSC__JSVa JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); } + extern "C" JSC__JSValue HTTPResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) { auto& vm = arg0->vm(); @@ -1226,6 +1287,7 @@ extern "C" void HTTPResponseSink__detachPtr(JSC__JSValue JSValue0) sink->detach(); return; } + if (auto* controller = JSC::jsDynamicCast<WebCore::JSReadableHTTPResponseSinkController*>(JSC::JSValue::decode(JSValue0))) { controller->detach(); @@ -1233,18 +1295,18 @@ extern "C" void HTTPResponseSink__detachPtr(JSC__JSValue JSValue0) } } -extern "C" JSC__JSValue HTTPResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) +extern "C" JSC__JSValue HTTPResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void **controllerValue) { auto& vm = arg0->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0); auto clientData = WebCore::clientData(vm); - JSC::JSObject* readableStream = JSC::JSValue::decode(stream).getObject(); + JSC::JSObject *readableStream = JSC::JSValue::decode(stream).getObject(); auto scope = DECLARE_CATCH_SCOPE(vm); JSC::Structure* structure = WebCore::getDOMStructure<WebCore::JSReadableHTTPResponseSinkController>(vm, *globalObject); - WebCore::JSReadableHTTPResponseSinkController* controller = WebCore::JSReadableHTTPResponseSinkController::create(vm, globalObject, structure, sinkPtr); + WebCore::JSReadableHTTPResponseSinkController *controller = WebCore::JSReadableHTTPResponseSinkController::create(vm, globalObject, structure, sinkPtr); *controllerValue = reinterpret_cast<void*>(JSC::JSValue::encode(controller)); - JSC::JSObject* function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); + JSC::JSObject *function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(JSC::JSValue::decode(stream)); @@ -1261,10 +1323,10 @@ extern "C" void HTTPResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSV { WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); + JSC::JSFunction *function = controller->m_onPull.get(); if (function == nullptr) return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; @@ -1277,18 +1339,19 @@ extern "C" void HTTPResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSV extern "C" void HTTPResponseSink__onStart(JSC__JSValue controllerValue) { + } extern "C" void HTTPResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) { WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); + JSC::JSFunction *function = controller->m_onClose.get(); if (function == nullptr) return; // only call close once controller->m_onClose.clear(); - JSC::JSGlobalObject* globalObject = controller->globalObject(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; @@ -1297,6 +1360,7 @@ extern "C" void HTTPResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSV JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); } + extern "C" JSC__JSValue HTTPSResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) { auto& vm = arg0->vm(); @@ -1324,6 +1388,7 @@ extern "C" void HTTPSResponseSink__detachPtr(JSC__JSValue JSValue0) sink->detach(); return; } + if (auto* controller = JSC::jsDynamicCast<WebCore::JSReadableHTTPSResponseSinkController*>(JSC::JSValue::decode(JSValue0))) { controller->detach(); @@ -1331,18 +1396,18 @@ extern "C" void HTTPSResponseSink__detachPtr(JSC__JSValue JSValue0) } } -extern "C" JSC__JSValue HTTPSResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void** controllerValue) +extern "C" JSC__JSValue HTTPSResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void **controllerValue) { auto& vm = arg0->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0); auto clientData = WebCore::clientData(vm); - JSC::JSObject* readableStream = JSC::JSValue::decode(stream).getObject(); + JSC::JSObject *readableStream = JSC::JSValue::decode(stream).getObject(); auto scope = DECLARE_CATCH_SCOPE(vm); JSC::Structure* structure = WebCore::getDOMStructure<WebCore::JSReadableHTTPSResponseSinkController>(vm, *globalObject); - WebCore::JSReadableHTTPSResponseSinkController* controller = WebCore::JSReadableHTTPSResponseSinkController::create(vm, globalObject, structure, sinkPtr); + WebCore::JSReadableHTTPSResponseSinkController *controller = WebCore::JSReadableHTTPSResponseSinkController::create(vm, globalObject, structure, sinkPtr); *controllerValue = reinterpret_cast<void*>(JSC::JSValue::encode(controller)); - JSC::JSObject* function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); + JSC::JSObject *function = globalObject->getDirect(vm, clientData->builtinNames().assignToStreamPrivateName()).getObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(JSC::JSValue::decode(stream)); @@ -1359,10 +1424,10 @@ extern "C" void HTTPSResponseSink__onReady(JSC__JSValue controllerValue, JSC__JS { WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPSResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); + JSC::JSFunction *function = controller->m_onPull.get(); if (function == nullptr) return; - JSC::JSGlobalObject* globalObject = controller->globalObject(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; @@ -1375,24 +1440,24 @@ extern "C" void HTTPSResponseSink__onReady(JSC__JSValue controllerValue, JSC__JS extern "C" void HTTPSResponseSink__onStart(JSC__JSValue controllerValue) { + } extern "C" void HTTPSResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) { WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPSResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); + JSC::JSFunction *function = controller->m_onClose.get(); if (function == nullptr) return; - - JSC::JSGlobalObject* globalObject = controller->globalObject(); + // only call close once + controller->m_onClose.clear(); + JSC::JSGlobalObject *globalObject = controller->globalObject(); auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(controller); arguments.append(JSC::JSValue::decode(reason)); JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); - - // only call close once - controller->m_onClose.clear(); } + diff --git a/src/bun.js/bindings/JSSink.h b/src/bun.js/bindings/JSSink.h index 537889a2d..1a69db9c6 100644 --- a/src/bun.js/bindings/JSSink.h +++ b/src/bun.js/bindings/JSSink.h @@ -1,6 +1,6 @@ // AUTO-GENERATED FILE. DO NOT EDIT. -// Generated by 'make generate-sink' at 2022-07-01T08:27:39.338Z +// Generated by 'make generate-sink' at 2022-07-02T06:06:00.509Z // #pragma once @@ -17,450 +17,457 @@ namespace WebCore { using namespace JSC; JSC_DECLARE_HOST_FUNCTION(functionStartDirectStream); -class JSArrayBufferSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSArrayBufferSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSArrayBufferSinkConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSArrayBufferSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSArrayBufferSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSArrayBufferSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSArrayBufferSink, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSArrayBufferSink(); - - void* wrapped() const { return m_sinkPtr; } - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - - JSArrayBufferSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableArrayBufferSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableArrayBufferSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::ArrayBufferSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSReadableArrayBufferSinkController, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableArrayBufferSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach() - { - m_sinkPtr = nullptr; - m_onPull.clear(); - m_onClose.clear(); - m_weakReadableStream.clear(); - } - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier<JSC::JSFunction> m_onPull; - mutable WriteBarrier<JSC::JSFunction> m_onClose; - mutable JSC::Weak<JSObject> m_weakReadableStream; - - JSReadableArrayBufferSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; +class JSArrayBufferSinkConstructor final : public JSC::InternalFunction { + public: + using Base = JSC::InternalFunction; + static JSArrayBufferSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); + static constexpr SinkID Sink = SinkID::ArrayBufferSink; + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSArrayBufferSinkConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); + } + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + private: + JSArrayBufferSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) + : Base(vm, structure, nativeFunction, nativeFunction) + + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + }; + + class JSArrayBufferSink final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSArrayBufferSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::ArrayBufferSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSArrayBufferSink, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSArrayBufferSink(); + + void* wrapped() const { return m_sinkPtr; } + + void detach() { + m_sinkPtr = nullptr; + + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + + JSArrayBufferSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; + + class JSReadableArrayBufferSinkController final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSReadableArrayBufferSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::ArrayBufferSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSReadableArrayBufferSinkController, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSReadableArrayBufferSinkController(); + + + void* wrapped() const { return m_sinkPtr; } + void detach() { + m_sinkPtr = nullptr; + m_onPull.clear(); + m_onClose.clear(); + m_weakReadableStream.clear(); + } + + void start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose); + DECLARE_VISIT_CHILDREN; + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + mutable WriteBarrier<JSC::JSFunction> m_onPull; + mutable WriteBarrier<JSC::JSFunction> m_onClose; + mutable JSC::Weak<JSObject> m_weakReadableStream; + + JSReadableArrayBufferSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; JSC_DECLARE_CUSTOM_GETTER(functionArrayBufferSink__getter); -class JSHTTPResponseSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSHTTPResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSHTTPResponseSinkConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSHTTPResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSHTTPResponseSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSHTTPResponseSink, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSHTTPResponseSink(); - - void* wrapped() const { return m_sinkPtr; } - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - - JSHTTPResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableHTTPResponseSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableHTTPResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPResponseSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSReadableHTTPResponseSinkController, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableHTTPResponseSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach() - { - m_sinkPtr = nullptr; - m_onPull.clear(); - m_onClose.clear(); - m_weakReadableStream.clear(); - } - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier<JSC::JSFunction> m_onPull; - mutable WriteBarrier<JSC::JSFunction> m_onClose; - mutable JSC::Weak<JSObject> m_weakReadableStream; - - JSReadableHTTPResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + +class JSHTTPResponseSinkConstructor final : public JSC::InternalFunction { + public: + using Base = JSC::InternalFunction; + static JSHTTPResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); + static constexpr SinkID Sink = SinkID::HTTPResponseSink; + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTTPResponseSinkConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); + } + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + private: + JSHTTPResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) + : Base(vm, structure, nativeFunction, nativeFunction) + + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + }; + + class JSHTTPResponseSink final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSHTTPResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::HTTPResponseSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTTPResponseSink, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSHTTPResponseSink(); + + void* wrapped() const { return m_sinkPtr; } + + void detach() { + m_sinkPtr = nullptr; + + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + + JSHTTPResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; + + class JSReadableHTTPResponseSinkController final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSReadableHTTPResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::HTTPResponseSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSReadableHTTPResponseSinkController, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSReadableHTTPResponseSinkController(); + + + void* wrapped() const { return m_sinkPtr; } + void detach() { + m_sinkPtr = nullptr; + m_onPull.clear(); + m_onClose.clear(); + m_weakReadableStream.clear(); + } + + void start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose); + DECLARE_VISIT_CHILDREN; + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + mutable WriteBarrier<JSC::JSFunction> m_onPull; + mutable WriteBarrier<JSC::JSFunction> m_onClose; + mutable JSC::Weak<JSObject> m_weakReadableStream; + + JSReadableHTTPResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; JSC_DECLARE_CUSTOM_GETTER(functionHTTPResponseSink__getter); -class JSHTTPSResponseSinkConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSHTTPSResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSHTTPSResponseSinkConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); - } - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - -private: - JSHTTPSResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) - : Base(vm, structure, nativeFunction, nativeFunction) - - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); -}; - -class JSHTTPSResponseSink final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSHTTPSResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSHTTPSResponseSink, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSHTTPSResponseSink(); - - void* wrapped() const { return m_sinkPtr; } - - void detach() - { - m_sinkPtr = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - - JSHTTPSResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; - -class JSReadableHTTPSResponseSinkController final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSReadableHTTPSResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); - static constexpr SinkID Sink = SinkID::HTTPSResponseSink; - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSReadableHTTPSResponseSinkController, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); - - ~JSReadableHTTPSResponseSinkController(); - - void* wrapped() const { return m_sinkPtr; } - void detach() - { - m_sinkPtr = nullptr; - m_onPull.clear(); - m_onClose.clear(); - m_weakReadableStream.clear(); - } - - void start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose); - DECLARE_VISIT_CHILDREN; - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - - void* m_sinkPtr; - mutable WriteBarrier<JSC::JSFunction> m_onPull; - mutable WriteBarrier<JSC::JSFunction> m_onClose; - mutable JSC::Weak<JSObject> m_weakReadableStream; - - JSReadableHTTPSResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_sinkPtr = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + +class JSHTTPSResponseSinkConstructor final : public JSC::InternalFunction { + public: + using Base = JSC::InternalFunction; + static JSHTTPSResponseSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); + static constexpr SinkID Sink = SinkID::HTTPSResponseSink; + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTTPSResponseSinkConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); }); + } + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + private: + JSHTTPSResponseSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) + : Base(vm, structure, nativeFunction, nativeFunction) + + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype); + }; + + class JSHTTPSResponseSink final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSHTTPSResponseSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::HTTPSResponseSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSHTTPSResponseSink, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSink.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSHTTPSResponseSink(); + + void* wrapped() const { return m_sinkPtr; } + + void detach() { + m_sinkPtr = nullptr; + + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + + JSHTTPSResponseSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; + + class JSReadableHTTPSResponseSinkController final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSReadableHTTPSResponseSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr); + static constexpr SinkID Sink = SinkID::HTTPSResponseSink; + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSReadableHTTPSResponseSinkController, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); + + ~JSReadableHTTPSResponseSinkController(); + + + void* wrapped() const { return m_sinkPtr; } + void detach() { + m_sinkPtr = nullptr; + m_onPull.clear(); + m_onClose.clear(); + m_weakReadableStream.clear(); + } + + void start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose); + DECLARE_VISIT_CHILDREN; + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + + void* m_sinkPtr; + mutable WriteBarrier<JSC::JSFunction> m_onPull; + mutable WriteBarrier<JSC::JSFunction> m_onClose; + mutable JSC::Weak<JSObject> m_weakReadableStream; + + JSReadableHTTPSResponseSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_sinkPtr = sinkPtr; + } + + void finishCreation(JSC::VM&); + }; JSC_DECLARE_CUSTOM_GETTER(functionHTTPSResponseSink__getter); + + JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID); JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID); diff --git a/src/bun.js/bindings/JSSinkLookupTable.h b/src/bun.js/bindings/JSSinkLookupTable.h index ed15ffa1e..bdd669d20 100644 --- a/src/bun.js/bindings/JSSinkLookupTable.h +++ b/src/bun.js/bindings/JSSinkLookupTable.h @@ -4,8 +4,8 @@ -static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -21,13 +21,14 @@ static const struct CompactHashIndex JSArrayBufferSinkPrototypeTableIndex[18] = { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSArrayBufferSinkPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__doClose), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__write), (intptr_t)(1) } }, @@ -42,8 +43,8 @@ static const struct HashTable JSArrayBufferSinkPrototypeTable = -static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -59,13 +60,14 @@ static const struct CompactHashIndex JSReadableArrayBufferSinkControllerPrototyp { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSReadableArrayBufferSinkControllerPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableArrayBufferSinkController__close), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableArrayBufferSinkController__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(ArrayBufferSink__write), (intptr_t)(1) } }, @@ -80,8 +82,8 @@ static const struct HashTable JSReadableArrayBufferSinkControllerPrototypeTable -static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -97,13 +99,14 @@ static const struct CompactHashIndex JSHTTPResponseSinkPrototypeTableIndex[18] = { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSHTTPResponseSinkPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__doClose), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__write), (intptr_t)(1) } }, @@ -118,8 +121,8 @@ static const struct HashTable JSHTTPResponseSinkPrototypeTable = -static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -135,13 +138,14 @@ static const struct CompactHashIndex JSReadableHTTPResponseSinkControllerPrototy { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSReadableHTTPResponseSinkControllerPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableHTTPResponseSinkController__close), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableHTTPResponseSinkController__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPResponseSink__write), (intptr_t)(1) } }, @@ -156,8 +160,8 @@ static const struct HashTable JSReadableHTTPResponseSinkControllerPrototypeTable -static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -173,13 +177,14 @@ static const struct CompactHashIndex JSHTTPSResponseSinkPrototypeTableIndex[18] { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSHTTPSResponseSinkPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__doClose), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__write), (intptr_t)(1) } }, @@ -194,8 +199,8 @@ static const struct HashTable JSHTTPSResponseSinkPrototypeTable = -static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerPrototypeTableIndex[18] = { - { 1, -1 }, +static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerPrototypeTableIndex[19] = { + { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, @@ -211,13 +216,14 @@ static const struct CompactHashIndex JSReadableHTTPSResponseSinkControllerProtot { -1, -1 }, { -1, -1 }, { 4, -1 }, - { 2, 17 }, + { 1, 17 }, + { 2, 18 }, { 3, -1 }, }; static const struct HashTableValue JSReadableHTTPSResponseSinkControllerPrototypeTableValues[5] = { { "close"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableHTTPSResponseSinkController__close), (intptr_t)(0) } }, - { "drain"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__drain), (intptr_t)(1) } }, + { "flush"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__flush), (intptr_t)(1) } }, { "end"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(JSReadableHTTPSResponseSinkController__end), (intptr_t)(0) } }, { "start"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__start), (intptr_t)(1) } }, { "write"_s, static_cast<unsigned>(PropertyAttribute::ReadOnly|PropertyAttribute::DontDelete|PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(HTTPSResponseSink__write), (intptr_t)(1) } }, diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 0d665c266..2df7c634c 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -1102,13 +1102,6 @@ pub const JSModuleRecord = extern struct { }; }; -pub fn Async(comptime ReturnType: type) type { - return struct { - promise: *?*JSPromise, - continuation: anyframe->ReturnType, - }; -} - pub const JSPromise = extern struct { pub const shim = Shimmer("JSC", "JSPromise", @This()); bytes: shim.Bytes, @@ -2405,14 +2398,6 @@ pub const JSValue = enum(JSValueReprInt) { return jsNumberWithType(@TypeOf(number), number); } - pub fn getReadableStreamState(value: JSValue, vm: *VM) ?*Exports.NodeReadableStream { - return cppFn("getReadableStreamState", .{ value, vm }); - } - - pub fn getWritableStreamState(value: JSValue, vm: *VM) ?*Exports.NodeWritableStream { - return cppFn("getWritableStreamState", .{ value, vm }); - } - pub fn jsNull() JSValue { return cppFn("jsNull", .{}); } @@ -2925,7 +2910,7 @@ pub const JSValue = enum(JSValueReprInt) { return @intToPtr(*anyopaque, @bitCast(usize, @enumToInt(this))); } - pub const Extern = [_][]const u8{ "createUninitializedUint8Array", "fromInt64NoTruncate", "fromUInt64NoTruncate", "toUInt64NoTruncate", "asPromise", "toInt64", "_then", "put", "makeWithNameAndPrototype", "parseJSON", "symbolKeyFor", "symbolFor", "getSymbolDescription", "createInternalPromise", "asInternalPromise", "asArrayBuffer_", "getReadableStreamState", "getWritableStreamState", "fromEntries", "createTypeError", "createRangeError", "createObject2", "getIfPropertyExistsImpl", "jsType", "jsonStringify", "kind_", "isTerminationException", "isSameValue", "getLengthOfArray", "toZigString", "createStringArray", "createEmptyObject", "putRecord", "asPromise", "isClass", "getNameProperty", "getClassName", "getErrorsProperty", "toInt32", "toBoolean", "isInt32", "isIterable", "forEach", "isAggregateError", "toZigException", "isException", "toWTFString", "hasProperty", "getPropertyNames", "getDirect", "putDirect", "getIfExists", "asString", "asObject", "asNumber", "isError", "jsNull", "jsUndefined", "jsTDZValue", "jsBoolean", "jsDoubleNumber", "jsNumberFromDouble", "jsNumberFromChar", "jsNumberFromU16", "jsNumberFromInt64", "isBoolean", "isAnyInt", "isUInt32AsAnyInt", "isInt32AsAnyInt", "isNumber", "isString", "isBigInt", "isHeapBigInt", "isBigInt32", "isSymbol", "isPrimitive", "isGetterSetter", "isCustomGetterSetter", "isObject", "isCell", "asCell", "toString", "toStringOrNull", "toPropertyKey", "toPropertyKeyValue", "toObject", "toString", "getPrototype", "getPropertyByPropertyName", "eqlValue", "eqlCell", "isCallable" }; + pub const Extern = [_][]const u8{ "createUninitializedUint8Array", "fromInt64NoTruncate", "fromUInt64NoTruncate", "toUInt64NoTruncate", "asPromise", "toInt64", "_then", "put", "makeWithNameAndPrototype", "parseJSON", "symbolKeyFor", "symbolFor", "getSymbolDescription", "createInternalPromise", "asInternalPromise", "asArrayBuffer_", "fromEntries", "createTypeError", "createRangeError", "createObject2", "getIfPropertyExistsImpl", "jsType", "jsonStringify", "kind_", "isTerminationException", "isSameValue", "getLengthOfArray", "toZigString", "createStringArray", "createEmptyObject", "putRecord", "asPromise", "isClass", "getNameProperty", "getClassName", "getErrorsProperty", "toInt32", "toBoolean", "isInt32", "isIterable", "forEach", "isAggregateError", "toZigException", "isException", "toWTFString", "hasProperty", "getPropertyNames", "getDirect", "putDirect", "getIfExists", "asString", "asObject", "asNumber", "isError", "jsNull", "jsUndefined", "jsTDZValue", "jsBoolean", "jsDoubleNumber", "jsNumberFromDouble", "jsNumberFromChar", "jsNumberFromU16", "jsNumberFromInt64", "isBoolean", "isAnyInt", "isUInt32AsAnyInt", "isInt32AsAnyInt", "isNumber", "isString", "isBigInt", "isHeapBigInt", "isBigInt32", "isSymbol", "isPrimitive", "isGetterSetter", "isCustomGetterSetter", "isObject", "isCell", "asCell", "toString", "toStringOrNull", "toPropertyKey", "toPropertyKeyValue", "toObject", "toString", "getPrototype", "getPropertyByPropertyName", "eqlValue", "eqlCell", "isCallable" }; }; extern "c" fn Microtask__run(*Microtask, *JSGlobalObject) void; diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h index 4036945b9..b7bb32042 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/bun.js/bindings/headers-cpp.h @@ -1,4 +1,4 @@ -//-- AUTOGENERATED FILE -- 1656340744 +//-- AUTOGENERATED FILE -- 1656747036 // clang-format off #pragma once @@ -216,22 +216,6 @@ extern "C" const size_t WTF__StringView_object_align_ = alignof(WTF::StringView) extern "C" const size_t Zig__GlobalObject_object_size_ = sizeof(Zig::GlobalObject); extern "C" const size_t Zig__GlobalObject_object_align_ = alignof(Zig::GlobalObject); -#ifndef INCLUDED_BunStream_h -#define INCLUDED_BunStream_h -#include "BunStream.h" -#endif - -extern "C" const size_t Bun__Readable_object_size_ = sizeof(Bun__Readable); -extern "C" const size_t Bun__Readable_object_align_ = alignof(Bun__Readable); - -#ifndef INCLUDED_BunStream_h -#define INCLUDED_BunStream_h -#include "BunStream.h" -#endif - -extern "C" const size_t Bun__Writable_object_size_ = sizeof(Bun__Writable); -extern "C" const size_t Bun__Writable_object_align_ = alignof(Bun__Writable); - #ifndef INCLUDED_Path_h #define INCLUDED_Path_h #include "Path.h" @@ -256,8 +240,8 @@ extern "C" const size_t Zig__ConsoleClient_object_align_ = alignof(Zig::ConsoleC extern "C" const size_t Bun__Timer_object_size_ = sizeof(Bun__Timer); extern "C" const size_t Bun__Timer_object_align_ = alignof(Bun__Timer); -const size_t sizes[34] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(Inspector::ScriptArguments), sizeof(JSC::JSModuleLoader), sizeof(JSC::JSModuleRecord), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::SourceOrigin), sizeof(JSC::SourceCode), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(WTF::URL), sizeof(WTF::String), sizeof(JSC::JSValue), sizeof(JSC::PropertyName), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(JSC::Identifier), sizeof(WTF::StringImpl), sizeof(WTF::ExternalStringImpl), sizeof(WTF::StringView), sizeof(Zig::GlobalObject), sizeof(Bun__Readable), sizeof(Bun__Writable), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink)}; +const size_t sizes[32] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(Inspector::ScriptArguments), sizeof(JSC::JSModuleLoader), sizeof(JSC::JSModuleRecord), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::SourceOrigin), sizeof(JSC::SourceCode), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(WTF::URL), sizeof(WTF::String), sizeof(JSC::JSValue), sizeof(JSC::PropertyName), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(JSC::Identifier), sizeof(WTF::StringImpl), sizeof(WTF::ExternalStringImpl), sizeof(WTF::StringView), sizeof(Zig::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink)}; -const char* names[34] = {"JSC__JSObject", "WebCore__DOMURL", "WebCore__FetchHeaders", "SystemError", "JSC__JSCell", "JSC__JSString", "Inspector__ScriptArguments", "JSC__JSModuleLoader", "JSC__JSModuleRecord", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__SourceOrigin", "JSC__SourceCode", "JSC__JSFunction", "JSC__JSGlobalObject", "WTF__URL", "WTF__String", "JSC__JSValue", "JSC__PropertyName", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "JSC__Identifier", "WTF__StringImpl", "WTF__ExternalStringImpl", "WTF__StringView", "Zig__GlobalObject", "Bun__Readable", "Bun__Writable", "Bun__Path", "ArrayBufferSink", "HTTPSResponseSink", "HTTPResponseSink"}; +const char* names[32] = {"JSC__JSObject", "WebCore__DOMURL", "WebCore__FetchHeaders", "SystemError", "JSC__JSCell", "JSC__JSString", "Inspector__ScriptArguments", "JSC__JSModuleLoader", "JSC__JSModuleRecord", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__SourceOrigin", "JSC__SourceCode", "JSC__JSFunction", "JSC__JSGlobalObject", "WTF__URL", "WTF__String", "JSC__JSValue", "JSC__PropertyName", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "JSC__Identifier", "WTF__StringImpl", "WTF__ExternalStringImpl", "WTF__StringView", "Zig__GlobalObject", "Bun__Path", "ArrayBufferSink", "HTTPSResponseSink", "HTTPResponseSink"}; -const size_t aligns[34] = {alignof(JSC::JSObject), alignof(WebCore::DOMURL), alignof(WebCore::FetchHeaders), alignof(SystemError), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(Inspector::ScriptArguments), alignof(JSC::JSModuleLoader), alignof(JSC::JSModuleRecord), alignof(JSC::JSPromise), alignof(JSC::JSInternalPromise), alignof(JSC::SourceOrigin), alignof(JSC::SourceCode), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(WTF::URL), alignof(WTF::String), alignof(JSC::JSValue), alignof(JSC::PropertyName), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::CatchScope), alignof(JSC::Identifier), alignof(WTF::StringImpl), alignof(WTF::ExternalStringImpl), alignof(WTF::StringView), alignof(Zig::GlobalObject), alignof(Bun__Readable), alignof(Bun__Writable), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink)}; +const size_t aligns[32] = {alignof(JSC::JSObject), alignof(WebCore::DOMURL), alignof(WebCore::FetchHeaders), alignof(SystemError), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(Inspector::ScriptArguments), alignof(JSC::JSModuleLoader), alignof(JSC::JSModuleRecord), alignof(JSC::JSPromise), alignof(JSC::JSInternalPromise), alignof(JSC::SourceOrigin), alignof(JSC::SourceCode), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(WTF::URL), alignof(WTF::String), alignof(JSC::JSValue), alignof(JSC::PropertyName), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::CatchScope), alignof(JSC::Identifier), alignof(WTF::StringImpl), alignof(WTF::ExternalStringImpl), alignof(WTF::StringView), alignof(Zig::GlobalObject), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink)}; diff --git a/src/bun.js/bindings/headers-handwritten.h b/src/bun.js/bindings/headers-handwritten.h index 3f0bf5327..358b58505 100644 --- a/src/bun.js/bindings/headers-handwritten.h +++ b/src/bun.js/bindings/headers-handwritten.h @@ -145,40 +145,6 @@ const ReadableEvent ReadableEvent__Resume = 6; const ReadableEvent ReadableEvent__Open = 7; const ReadableEvent ReadableEventUser = 254; -typedef struct { - uint32_t highwater_mark; - Encoding encoding; - int32_t start; - int32_t end; - bool readable; - bool aborted; - bool did_read; - bool ended; - uint8_t flowing; - bool emit_close; - bool emit_end; -} Bun__Readable; - -typedef struct { - uint32_t highwater_mark; - Encoding encoding; - uint32_t start; - bool destroyed; - bool ended; - bool corked; - bool finished; - bool emit_close; -} Bun__Writable; - -typedef struct { - char* ptr; - uint32_t offset; - uint32_t len; - uint32_t byte_len; - uint8_t cell_type; - uint64_t _value; -} Bun__ArrayBuffer; - #ifndef STRING_POINTER #define STRING_POINTER typedef struct StringPointer { @@ -192,8 +158,21 @@ typedef void WebSocketHTTPSClient; typedef void WebSocketClient; typedef void WebSocketClientTLS; +#ifndef __cplusplus +typedef struct Bun__ArrayBuffer Bun__ArrayBuffer; +#endif + #ifdef __cplusplus +typedef struct { + char* ptr; + uint32_t offset; + uint32_t len; + uint32_t byte_len; + uint8_t cell_type; + uint64_t _value; +} Bun__ArrayBuffer; + extern "C" ZigErrorCode Zig_ErrorCodeParserError; extern "C" void ZigString__free(const unsigned char* ptr, size_t len, void* allocator); diff --git a/src/bun.js/bindings/headers-replacements.zig b/src/bun.js/bindings/headers-replacements.zig index 662502bb2..5f304b850 100644 --- a/src/bun.js/bindings/headers-replacements.zig +++ b/src/bun.js/bindings/headers-replacements.zig @@ -1,4 +1,3 @@ -// GENERATED FILE - do not modify! const bindings = @import("../../jsc.zig"); pub const struct_JSC__CallFrame = bindings.CallFrame; pub const struct_JSC__StringPrototype = bindings.StringPrototype; diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 660e8b250..1877339b1 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -1,5 +1,5 @@ // clang-format off -//-- AUTOGENERATED FILE -- 1656340744 +//-- AUTOGENERATED FILE -- 1656747036 #pragma once #include <stddef.h> @@ -98,13 +98,11 @@ typedef void* JSClassRef; typedef SystemError SystemError; typedef bJSC__JSCell JSC__JSCell; // JSC::JSCell typedef bJSC__SourceOrigin JSC__SourceOrigin; // JSC::SourceOrigin - typedef Bun__Writable Bun__Writable; typedef bJSC__JSModuleRecord JSC__JSModuleRecord; // JSC::JSModuleRecord typedef bWTF__String WTF__String; // WTF::String typedef bWTF__URL WTF__URL; // WTF::URL typedef struct JSC__IteratorPrototype JSC__IteratorPrototype; // JSC::IteratorPrototype typedef bJSC__JSInternalPromise JSC__JSInternalPromise; // JSC::JSInternalPromise - typedef Bun__Readable Bun__Readable; typedef struct JSC__RegExpPrototype JSC__RegExpPrototype; // JSC::RegExpPrototype typedef struct JSC__CallFrame JSC__CallFrame; // JSC::CallFrame typedef struct JSC__MapIteratorPrototype JSC__MapIteratorPrototype; // JSC::MapIteratorPrototype @@ -197,8 +195,6 @@ typedef void* JSClassRef; typedef WebSocketClientTLS WebSocketClientTLS; typedef WebSocketHTTPClient WebSocketHTTPClient; typedef SystemError SystemError; - typedef Bun__Writable Bun__Writable; - typedef Bun__Readable Bun__Readable; typedef WebSocketHTTPSClient WebSocketHTTPSClient; typedef JSClassRef JSClassRef; typedef Bun__ArrayBuffer Bun__ArrayBuffer; @@ -490,9 +486,7 @@ CPP_DECL JSC__JSValue JSC__JSValue__getIfPropertyExistsImpl(JSC__JSValue JSValue CPP_DECL uint32_t JSC__JSValue__getLengthOfArray(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); CPP_DECL void JSC__JSValue__getNameProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); CPP_DECL JSC__JSValue JSC__JSValue__getPrototype(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL Bun__Readable* JSC__JSValue__getReadableStreamState(JSC__JSValue JSValue0, JSC__VM* arg1); CPP_DECL void JSC__JSValue__getSymbolDescription(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); -CPP_DECL Bun__Writable* JSC__JSValue__getWritableStreamState(JSC__JSValue JSValue0, JSC__VM* arg1); CPP_DECL bool JSC__JSValue__isAggregateError(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); CPP_DECL bool JSC__JSValue__isAnyInt(JSC__JSValue JSValue0); CPP_DECL bool JSC__JSValue__isBigInt(JSC__JSValue JSValue0); @@ -669,44 +663,6 @@ ZIG_DECL bool Zig__ErrorType__isPrivateData(void* arg0); #endif -#pragma mark - Bun__Readable - -CPP_DECL JSC__JSValue Bun__Readable__create(Bun__Readable* arg0, JSC__JSGlobalObject* arg1); - -#ifdef __cplusplus - -ZIG_DECL void Bun__Readable__addEventListener(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3, bool arg4); -ZIG_DECL void Bun__Readable__deinit(Bun__Readable* arg0); -ZIG_DECL JSC__JSValue Bun__Readable__pause(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Readable__pipe(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL void Bun__Readable__prependEventListener(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3, bool arg4); -ZIG_DECL JSC__JSValue Bun__Readable__read(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL bool Bun__Readable__removeEventListener(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3); -ZIG_DECL JSC__JSValue Bun__Readable__resume(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Readable__unpipe(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Readable__unshift(Bun__Readable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); - -#endif - -#pragma mark - Bun__Writable - -CPP_DECL JSC__JSValue Bun__Writable__create(Bun__Writable* arg0, JSC__JSGlobalObject* arg1); - -#ifdef __cplusplus - -ZIG_DECL void Bun__Writable__addEventListener(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3, bool arg4); -ZIG_DECL JSC__JSValue Bun__Writable__close(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Writable__cork(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL void Bun__Writable__deinit(Bun__Writable* arg0); -ZIG_DECL JSC__JSValue Bun__Writable__destroy(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Writable__end(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL void Bun__Writable__prependEventListener(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3, bool arg4); -ZIG_DECL bool Bun__Writable__removeEventListener(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, unsigned char Events2, JSC__JSValue JSValue3); -ZIG_DECL JSC__JSValue Bun__Writable__uncork(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); -ZIG_DECL JSC__JSValue Bun__Writable__write(Bun__Writable* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue* arg2, uint16_t arg3); - -#endif - #pragma mark - Bun__Path CPP_DECL JSC__JSValue Bun__Path__create(JSC__JSGlobalObject* arg0, bool arg1); @@ -748,10 +704,10 @@ CPP_DECL void ArrayBufferSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSVal ZIG_DECL JSC__JSValue ArrayBufferSink__close(JSC__JSGlobalObject* arg0, void* arg1); ZIG_DECL JSC__JSValue ArrayBufferSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); -ZIG_DECL JSC__JSValue ArrayBufferSink__drain(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue ArrayBufferSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue ArrayBufferSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); ZIG_DECL void ArrayBufferSink__finalize(void* arg0); +ZIG_DECL JSC__JSValue ArrayBufferSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue ArrayBufferSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue ArrayBufferSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); @@ -767,10 +723,10 @@ CPP_DECL void HTTPSResponseSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSV ZIG_DECL JSC__JSValue HTTPSResponseSink__close(JSC__JSGlobalObject* arg0, void* arg1); ZIG_DECL JSC__JSValue HTTPSResponseSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); -ZIG_DECL JSC__JSValue HTTPSResponseSink__drain(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPSResponseSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPSResponseSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); ZIG_DECL void HTTPSResponseSink__finalize(void* arg0); +ZIG_DECL JSC__JSValue HTTPSResponseSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPSResponseSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPSResponseSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); @@ -786,10 +742,10 @@ CPP_DECL void HTTPResponseSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSVa ZIG_DECL JSC__JSValue HTTPResponseSink__close(JSC__JSGlobalObject* arg0, void* arg1); ZIG_DECL JSC__JSValue HTTPResponseSink__construct(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); -ZIG_DECL JSC__JSValue HTTPResponseSink__drain(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPResponseSink__end(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPResponseSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); ZIG_DECL void HTTPResponseSink__finalize(void* arg0); +ZIG_DECL JSC__JSValue HTTPResponseSink__flush(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPResponseSink__start(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); ZIG_DECL JSC__JSValue HTTPResponseSink__write(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); diff --git a/src/bun.js/bindings/headers.zig b/src/bun.js/bindings/headers.zig index 10a13dc97..c0db6777a 100644 --- a/src/bun.js/bindings/headers.zig +++ b/src/bun.js/bindings/headers.zig @@ -1,4 +1,5 @@ -// GENERATED FILE - do not modify! +// GENERATED CODE - DO NOT MODIFY BY HAND + const bindings = @import("../../jsc.zig"); pub const struct_JSC__CallFrame = bindings.CallFrame; pub const struct_JSC__StringPrototype = bindings.StringPrototype; @@ -70,167 +71,108 @@ pub const WebSocketHTTPClient = bindings.WebSocketHTTPClient; pub const WebSocketHTTPSClient = bindings.WebSocketHTTPSClient; pub const WebSocketClient = bindings.WebSocketClient; pub const WebSocketClientTLS = bindings.WebSocketClientTLS; -// GENERATED CODE - DO NOT MODIFY BY HAND - -pub const ptrdiff_t = c_long; -pub const wchar_t = c_int; -pub const __uint16_t = c_ushort; -pub const __int32_t = c_int; -pub const __uint32_t = c_uint; -pub const __int64_t = c_longlong; -pub const __uint64_t = c_ulonglong; -pub const __mbstate_t = extern union { - __mbstate8: [128]u8, - _mbstateL: c_longlong, -}; - -pub const VirtualMachine = struct_VirtualMachine; - -pub const JSC__GeneratorPrototype = struct_JSC__GeneratorPrototype; - -pub const JSC__ArrayIteratorPrototype = struct_JSC__ArrayIteratorPrototype; - -pub const JSC__JSPromisePrototype = struct_JSC__JSPromisePrototype; pub const JSC__PropertyName = bJSC__PropertyName; pub const JSC__JSObject = bJSC__JSObject; pub const WTF__ExternalStringImpl = bWTF__ExternalStringImpl; - -pub const JSC__AsyncIteratorPrototype = struct_JSC__AsyncIteratorPrototype; pub const JSC__JSModuleLoader = bJSC__JSModuleLoader; - -pub const JSC__AsyncGeneratorPrototype = struct_JSC__AsyncGeneratorPrototype; - -pub const JSC__AsyncGeneratorFunctionPrototype = struct_JSC__AsyncGeneratorFunctionPrototype; pub const JSC__Identifier = bJSC__Identifier; - -pub const JSC__ArrayPrototype = struct_JSC__ArrayPrototype; - -pub const Zig__JSMicrotaskCallback = struct_Zig__JSMicrotaskCallback; pub const JSC__JSPromise = bJSC__JSPromise; - -pub const JSC__SetIteratorPrototype = struct_JSC__SetIteratorPrototype; pub const JSC__JSCell = bJSC__JSCell; pub const JSC__SourceOrigin = bJSC__SourceOrigin; pub const JSC__JSModuleRecord = bJSC__JSModuleRecord; pub const WTF__String = bWTF__String; pub const WTF__URL = bWTF__URL; - -pub const JSC__IteratorPrototype = struct_JSC__IteratorPrototype; pub const JSC__JSInternalPromise = bJSC__JSInternalPromise; - -pub const JSC__RegExpPrototype = struct_JSC__RegExpPrototype; - -pub const JSC__CallFrame = struct_JSC__CallFrame; - -pub const JSC__MapIteratorPrototype = struct_JSC__MapIteratorPrototype; - -pub const WebCore__FetchHeaders = struct_WebCore__FetchHeaders; pub const WTF__StringView = bWTF__StringView; pub const JSC__ThrowScope = bJSC__ThrowScope; pub const WTF__StringImpl = bWTF__StringImpl; pub const JSC__VM = bJSC__VM; pub const JSC__JSGlobalObject = bJSC__JSGlobalObject; pub const JSC__JSFunction = bJSC__JSFunction; - -pub const JSC__AsyncFunctionPrototype = struct_JSC__AsyncFunctionPrototype; pub const JSC__SourceCode = bJSC__SourceCode; - -pub const JSC__BigIntPrototype = struct_JSC__BigIntPrototype; - -pub const JSC__GeneratorFunctionPrototype = struct_JSC__GeneratorFunctionPrototype; - -pub const WebCore__DOMURL = struct_WebCore__DOMURL; - - -pub const JSC__FunctionPrototype = struct_JSC__FunctionPrototype; -pub const Inspector__ScriptArguments = bInspector__ScriptArguments; pub const JSC__Exception = bJSC__Exception; pub const JSC__JSString = bJSC__JSString; - -pub const JSC__ObjectPrototype = struct_JSC__ObjectPrototype; - -pub const JSC__StringPrototype = struct_JSC__StringPrototype; -pub extern fn JSC__JSObject__create(arg0: [*c]JSC__JSGlobalObject, arg1: usize, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, [*c]JSC__JSObject, [*c]JSC__JSGlobalObject) callconv(.C) void) JSC__JSValue; +pub extern fn JSC__JSObject__create(arg0: ?*JSC__JSGlobalObject, arg1: usize, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, [*c]JSC__JSObject, ?*JSC__JSGlobalObject) callconv(.C) void) JSC__JSValue; pub extern fn JSC__JSObject__getArrayLength(arg0: [*c]JSC__JSObject) usize; -pub extern fn JSC__JSObject__getDirect(arg0: [*c]JSC__JSObject, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]const ZigString) JSC__JSValue; -pub extern fn JSC__JSObject__getIndex(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: u32) JSC__JSValue; -pub extern fn JSC__JSObject__putRecord(arg0: [*c]JSC__JSObject, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; -pub extern fn ZigString__external(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; -pub extern fn ZigString__to16BitValue(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn ZigString__toErrorInstance(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn ZigString__toExternalU16(arg0: [*c]const u16, arg1: usize, arg2: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn ZigString__toExternalValue(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn ZigString__toExternalValueWithCallback(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject, ArgFn2: ?fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; -pub extern fn ZigString__toValue(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn ZigString__toValueGC(arg0: [*c]const ZigString, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn WebCore__DOMURL__cast_(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) ?*WebCore__DOMURL; -pub extern fn WebCore__DOMURL__href_(arg0: ?*WebCore__DOMURL, arg1: [*c]ZigString) void; -pub extern fn WebCore__DOMURL__pathname_(arg0: ?*WebCore__DOMURL, arg1: [*c]ZigString) void; -pub extern fn WebCore__FetchHeaders__append(arg0: ?*WebCore__FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString) void; -pub extern fn WebCore__FetchHeaders__cast_(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__clone(arg0: ?*WebCore__FetchHeaders, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn WebCore__FetchHeaders__cloneThis(arg0: ?*WebCore__FetchHeaders) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__copyTo(arg0: ?*WebCore__FetchHeaders, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]u8) void; -pub extern fn WebCore__FetchHeaders__count(arg0: ?*WebCore__FetchHeaders, arg1: [*c]u32, arg2: [*c]u32) void; -pub extern fn WebCore__FetchHeaders__createEmpty(...) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__createFromJS(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: [*c]JSC__JSGlobalObject, arg1: ?*const anyopaque) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__createFromUWS(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque) ?*WebCore__FetchHeaders; -pub extern fn WebCore__FetchHeaders__createValue(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) JSC__JSValue; -pub extern fn WebCore__FetchHeaders__deref(arg0: ?*WebCore__FetchHeaders) void; -pub extern fn WebCore__FetchHeaders__get_(arg0: ?*WebCore__FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]ZigString) void; -pub extern fn WebCore__FetchHeaders__has(arg0: ?*WebCore__FetchHeaders, arg1: [*c]const ZigString) bool; -pub extern fn WebCore__FetchHeaders__put_(arg0: ?*WebCore__FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString) void; -pub extern fn WebCore__FetchHeaders__remove(arg0: ?*WebCore__FetchHeaders, arg1: [*c]const ZigString) void; -pub extern fn WebCore__FetchHeaders__toJS(arg0: ?*WebCore__FetchHeaders, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn WebCore__FetchHeaders__toUWSResponse(arg0: ?*WebCore__FetchHeaders, arg1: bool, arg2: ?*anyopaque) void; -pub extern fn SystemError__toErrorInstance(arg0: [*c]const SystemError, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSObject__getDirect(arg0: [*c]JSC__JSObject, arg1: ?*JSC__JSGlobalObject, arg2: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSObject__getIndex(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: u32) JSC__JSValue; +pub extern fn JSC__JSObject__putRecord(arg0: [*c]JSC__JSObject, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; +pub extern fn ZigString__external(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; +pub extern fn ZigString__to16BitValue(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toErrorInstance(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalU16(arg0: [*c]const u16, arg1: usize, arg2: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalValue(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalValueWithCallback(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject, ArgFn2: ?fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; +pub extern fn ZigString__toValue(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toValueGC(arg0: [*c]const ZigString, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__DOMURL__cast_(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) ?*bindings.DOMURL; +pub extern fn WebCore__DOMURL__href_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; +pub extern fn WebCore__DOMURL__pathname_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; +pub extern fn WebCore__FetchHeaders__append(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString) void; +pub extern fn WebCore__FetchHeaders__cast_(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__clone(arg0: ?*bindings.FetchHeaders, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__cloneThis(arg0: ?*bindings.FetchHeaders) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__copyTo(arg0: ?*bindings.FetchHeaders, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]u8) void; +pub extern fn WebCore__FetchHeaders__count(arg0: ?*bindings.FetchHeaders, arg1: [*c]u32, arg2: [*c]u32) void; +pub extern fn WebCore__FetchHeaders__createEmpty(...) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromJS(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: ?*JSC__JSGlobalObject, arg1: ?*const anyopaque) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromUWS(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createValue(arg0: ?*JSC__JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__deref(arg0: ?*bindings.FetchHeaders) void; +pub extern fn WebCore__FetchHeaders__get_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]ZigString) void; +pub extern fn WebCore__FetchHeaders__has(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString) bool; +pub extern fn WebCore__FetchHeaders__put_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString) void; +pub extern fn WebCore__FetchHeaders__remove(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString) void; +pub extern fn WebCore__FetchHeaders__toJS(arg0: ?*bindings.FetchHeaders, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__toUWSResponse(arg0: ?*bindings.FetchHeaders, arg1: bool, arg2: ?*anyopaque) void; +pub extern fn SystemError__toErrorInstance(arg0: [*c]const SystemError, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; pub extern fn JSC__JSCell__getObject(arg0: [*c]JSC__JSCell) [*c]JSC__JSObject; -pub extern fn JSC__JSCell__getString(arg0: [*c]JSC__JSCell, arg1: [*c]JSC__JSGlobalObject) bWTF__String; +pub extern fn JSC__JSCell__getString(arg0: [*c]JSC__JSCell, arg1: ?*JSC__JSGlobalObject) bWTF__String; pub extern fn JSC__JSCell__getType(arg0: [*c]JSC__JSCell) u8; pub extern fn JSC__JSString__createFromOwnedString(arg0: [*c]JSC__VM, arg1: [*c]const WTF__String) [*c]JSC__JSString; pub extern fn JSC__JSString__createFromString(arg0: [*c]JSC__VM, arg1: [*c]const WTF__String) [*c]JSC__JSString; -pub extern fn JSC__JSString__eql(arg0: [*c]const JSC__JSString, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]JSC__JSString) bool; +pub extern fn JSC__JSString__eql(arg0: [*c]const JSC__JSString, arg1: ?*JSC__JSGlobalObject, arg2: [*c]JSC__JSString) bool; pub extern fn JSC__JSString__is8Bit(arg0: [*c]const JSC__JSString) bool; -pub extern fn JSC__JSString__iterator(arg0: [*c]JSC__JSString, arg1: [*c]JSC__JSGlobalObject, arg2: ?*anyopaque) void; +pub extern fn JSC__JSString__iterator(arg0: [*c]JSC__JSString, arg1: ?*JSC__JSGlobalObject, arg2: ?*anyopaque) void; pub extern fn JSC__JSString__length(arg0: [*c]const JSC__JSString) usize; -pub extern fn JSC__JSString__toObject(arg0: [*c]JSC__JSString, arg1: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSString__value(arg0: [*c]JSC__JSString, arg1: [*c]JSC__JSGlobalObject) bWTF__String; -pub extern fn Inspector__ScriptArguments__argumentAt(arg0: [*c]Inspector__ScriptArguments, arg1: usize) JSC__JSValue; -pub extern fn Inspector__ScriptArguments__argumentCount(arg0: [*c]Inspector__ScriptArguments) usize; -pub extern fn Inspector__ScriptArguments__getFirstArgumentAsString(arg0: [*c]Inspector__ScriptArguments) bWTF__String; -pub extern fn Inspector__ScriptArguments__isEqual(arg0: [*c]Inspector__ScriptArguments, arg1: [*c]Inspector__ScriptArguments) bool; -pub extern fn Inspector__ScriptArguments__release(arg0: [*c]Inspector__ScriptArguments) void; -pub extern fn JSC__JSModuleLoader__checkSyntax(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const JSC__SourceCode, arg2: bool) bool; -pub extern fn JSC__JSModuleLoader__evaluate(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const u8, arg2: usize, arg3: [*c]const u8, arg4: usize, JSValue5: JSC__JSValue, arg6: [*c]JSC__JSValue) JSC__JSValue; -pub extern fn JSC__JSModuleLoader__importModule(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const JSC__Identifier) [*c]JSC__JSInternalPromise; -pub extern fn JSC__JSModuleLoader__linkAndEvaluateModule(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const JSC__Identifier) JSC__JSValue; -pub extern fn JSC__JSModuleLoader__loadAndEvaluateModule(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const ZigString) [*c]JSC__JSInternalPromise; -pub extern fn JSC__JSModuleLoader__loadAndEvaluateModuleEntryPoint(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const JSC__SourceCode) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSString__toObject(arg0: [*c]JSC__JSString, arg1: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSString__value(arg0: [*c]JSC__JSString, arg1: ?*JSC__JSGlobalObject) bWTF__String; +pub extern fn Inspector__ScriptArguments__argumentAt(arg0: [*c]bindings.ScriptArguments, arg1: usize) JSC__JSValue; +pub extern fn Inspector__ScriptArguments__argumentCount(arg0: [*c]bindings.ScriptArguments) usize; +pub extern fn Inspector__ScriptArguments__getFirstArgumentAsString(arg0: [*c]bindings.ScriptArguments) bWTF__String; +pub extern fn Inspector__ScriptArguments__isEqual(arg0: [*c]bindings.ScriptArguments, arg1: [*c]bindings.ScriptArguments) bool; +pub extern fn Inspector__ScriptArguments__release(arg0: [*c]bindings.ScriptArguments) void; +pub extern fn JSC__JSModuleLoader__checkSyntax(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const JSC__SourceCode, arg2: bool) bool; +pub extern fn JSC__JSModuleLoader__evaluate(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const u8, arg2: usize, arg3: [*c]const u8, arg4: usize, JSValue5: JSC__JSValue, arg6: [*c]JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSModuleLoader__importModule(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const JSC__Identifier) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSModuleLoader__linkAndEvaluateModule(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const JSC__Identifier) JSC__JSValue; +pub extern fn JSC__JSModuleLoader__loadAndEvaluateModule(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const ZigString) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSModuleLoader__loadAndEvaluateModuleEntryPoint(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const JSC__SourceCode) [*c]JSC__JSInternalPromise; pub extern fn JSC__JSModuleRecord__sourceCode(arg0: [*c]JSC__JSModuleRecord) bJSC__SourceCode; -pub extern fn JSC__JSPromise__asValue(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSPromise__create(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSPromise; +pub extern fn JSC__JSPromise__asValue(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSPromise__create(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSPromise; pub extern fn JSC__JSPromise__isHandled(arg0: [*c]const JSC__JSPromise, arg1: [*c]JSC__VM) bool; -pub extern fn JSC__JSPromise__reject(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSPromise__rejectAsHandled(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSPromise__rejectAsHandledException(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]JSC__Exception) void; -pub extern fn JSC__JSPromise__rejectedPromise(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSPromise; -pub extern fn JSC__JSPromise__rejectedPromiseValue(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; -pub extern fn JSC__JSPromise__rejectWithCaughtException(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject, arg2: bJSC__ThrowScope) void; -pub extern fn JSC__JSPromise__resolve(arg0: [*c]JSC__JSPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSPromise__resolvedPromise(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSPromise; -pub extern fn JSC__JSPromise__resolvedPromiseValue(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSPromise__reject(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__rejectAsHandled(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__rejectAsHandledException(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject, arg2: [*c]JSC__Exception) void; +pub extern fn JSC__JSPromise__rejectedPromise(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSPromise; +pub extern fn JSC__JSPromise__rejectedPromiseValue(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSPromise__rejectWithCaughtException(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject, arg2: bJSC__ThrowScope) void; +pub extern fn JSC__JSPromise__resolve(arg0: [*c]JSC__JSPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__resolvedPromise(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSPromise; +pub extern fn JSC__JSPromise__resolvedPromiseValue(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; pub extern fn JSC__JSPromise__result(arg0: [*c]const JSC__JSPromise, arg1: [*c]JSC__VM) JSC__JSValue; pub extern fn JSC__JSPromise__status(arg0: [*c]const JSC__JSPromise, arg1: [*c]JSC__VM) u32; -pub extern fn JSC__JSInternalPromise__create(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSInternalPromise__create(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSInternalPromise; pub extern fn JSC__JSInternalPromise__isHandled(arg0: [*c]const JSC__JSInternalPromise, arg1: [*c]JSC__VM) bool; -pub extern fn JSC__JSInternalPromise__reject(arg0: [*c]JSC__JSInternalPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSInternalPromise__rejectAsHandled(arg0: [*c]JSC__JSInternalPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSInternalPromise__rejectAsHandledException(arg0: [*c]JSC__JSInternalPromise, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]JSC__Exception) void; -pub extern fn JSC__JSInternalPromise__rejectedPromise(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSInternalPromise; -pub extern fn JSC__JSInternalPromise__rejectWithCaughtException(arg0: [*c]JSC__JSInternalPromise, arg1: [*c]JSC__JSGlobalObject, arg2: bJSC__ThrowScope) void; -pub extern fn JSC__JSInternalPromise__resolve(arg0: [*c]JSC__JSInternalPromise, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern fn JSC__JSInternalPromise__resolvedPromise(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSInternalPromise__reject(arg0: [*c]JSC__JSInternalPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__rejectAsHandled(arg0: [*c]JSC__JSInternalPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__rejectAsHandledException(arg0: [*c]JSC__JSInternalPromise, arg1: ?*JSC__JSGlobalObject, arg2: [*c]JSC__Exception) void; +pub extern fn JSC__JSInternalPromise__rejectedPromise(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSInternalPromise; +pub extern fn JSC__JSInternalPromise__rejectWithCaughtException(arg0: [*c]JSC__JSInternalPromise, arg1: ?*JSC__JSGlobalObject, arg2: bJSC__ThrowScope) void; +pub extern fn JSC__JSInternalPromise__resolve(arg0: [*c]JSC__JSInternalPromise, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__resolvedPromise(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) [*c]JSC__JSInternalPromise; pub extern fn JSC__JSInternalPromise__result(arg0: [*c]const JSC__JSInternalPromise, arg1: [*c]JSC__VM) JSC__JSValue; pub extern fn JSC__JSInternalPromise__status(arg0: [*c]const JSC__JSInternalPromise, arg1: [*c]JSC__VM) u32; pub extern fn JSC__SourceOrigin__fromURL(arg0: [*c]const WTF__URL) bJSC__SourceOrigin; @@ -238,38 +180,38 @@ pub extern fn JSC__SourceCode__fromString(arg0: [*c]JSC__SourceCode, arg1: [*c]c pub extern fn JSC__JSFunction__calculatedDisplayName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String; pub extern fn JSC__JSFunction__displayName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String; pub extern fn JSC__JSFunction__getName(arg0: [*c]JSC__JSFunction, arg1: [*c]JSC__VM) bWTF__String; -pub extern fn JSC__JSGlobalObject__arrayIteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__ArrayIteratorPrototype; -pub extern fn JSC__JSGlobalObject__arrayPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__ArrayPrototype; -pub extern fn JSC__JSGlobalObject__asyncFunctionPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__AsyncFunctionPrototype; -pub extern fn JSC__JSGlobalObject__asyncGeneratorFunctionPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__AsyncGeneratorFunctionPrototype; -pub extern fn JSC__JSGlobalObject__asyncGeneratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__AsyncGeneratorPrototype; -pub extern fn JSC__JSGlobalObject__asyncIteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__AsyncIteratorPrototype; -pub extern fn JSC__JSGlobalObject__bigIntPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__BigIntPrototype; -pub extern fn JSC__JSGlobalObject__booleanPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__bunVM(arg0: [*c]JSC__JSGlobalObject) ?*VirtualMachine; -pub extern fn JSC__JSGlobalObject__createAggregateError(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]*anyopaque, arg2: u16, arg3: [*c]const ZigString) JSC__JSValue; -pub extern fn JSC__JSGlobalObject__datePrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__deleteModuleRegistryEntry(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]ZigString) void; -pub extern fn JSC__JSGlobalObject__errorPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__functionPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__FunctionPrototype; -pub extern fn JSC__JSGlobalObject__generateHeapSnapshot(arg0: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSGlobalObject__generatorFunctionPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__GeneratorFunctionPrototype; -pub extern fn JSC__JSGlobalObject__generatorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__GeneratorPrototype; -pub extern fn JSC__JSGlobalObject__getCachedObject(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const ZigString) JSC__JSValue; -pub extern fn JSC__JSGlobalObject__iteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__IteratorPrototype; -pub extern fn JSC__JSGlobalObject__jsSetPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__mapIteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__MapIteratorPrototype; -pub extern fn JSC__JSGlobalObject__mapPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__numberPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__objectPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__ObjectPrototype; -pub extern fn JSC__JSGlobalObject__promisePrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__JSPromisePrototype; -pub extern fn JSC__JSGlobalObject__putCachedObject(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const ZigString, JSValue2: JSC__JSValue) JSC__JSValue; -pub extern fn JSC__JSGlobalObject__regExpPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__RegExpPrototype; -pub extern fn JSC__JSGlobalObject__setIteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__SetIteratorPrototype; -pub extern fn JSC__JSGlobalObject__startRemoteInspector(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]u8, arg2: u16) bool; -pub extern fn JSC__JSGlobalObject__stringPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__StringPrototype; -pub extern fn JSC__JSGlobalObject__symbolPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSGlobalObject__vm(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__VM; +pub extern fn JSC__JSGlobalObject__arrayIteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.ArrayIteratorPrototype; +pub extern fn JSC__JSGlobalObject__arrayPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.ArrayPrototype; +pub extern fn JSC__JSGlobalObject__asyncFunctionPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.AsyncFunctionPrototype; +pub extern fn JSC__JSGlobalObject__asyncGeneratorFunctionPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.AsyncGeneratorFunctionPrototype; +pub extern fn JSC__JSGlobalObject__asyncGeneratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.AsyncGeneratorPrototype; +pub extern fn JSC__JSGlobalObject__asyncIteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.AsyncIteratorPrototype; +pub extern fn JSC__JSGlobalObject__bigIntPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.BigIntPrototype; +pub extern fn JSC__JSGlobalObject__booleanPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__bunVM(arg0: ?*JSC__JSGlobalObject) ?*bindings.VirtualMachine; +pub extern fn JSC__JSGlobalObject__createAggregateError(arg0: ?*JSC__JSGlobalObject, arg1: [*c]*anyopaque, arg2: u16, arg3: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__datePrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__deleteModuleRegistryEntry(arg0: ?*JSC__JSGlobalObject, arg1: [*c]ZigString) void; +pub extern fn JSC__JSGlobalObject__errorPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__functionPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.FunctionPrototype; +pub extern fn JSC__JSGlobalObject__generateHeapSnapshot(arg0: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__generatorFunctionPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.GeneratorFunctionPrototype; +pub extern fn JSC__JSGlobalObject__generatorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.GeneratorPrototype; +pub extern fn JSC__JSGlobalObject__getCachedObject(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__iteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.IteratorPrototype; +pub extern fn JSC__JSGlobalObject__jsSetPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__mapIteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.MapIteratorPrototype; +pub extern fn JSC__JSGlobalObject__mapPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__numberPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__objectPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.ObjectPrototype; +pub extern fn JSC__JSGlobalObject__promisePrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.JSPromisePrototype; +pub extern fn JSC__JSGlobalObject__putCachedObject(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const ZigString, JSValue2: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__regExpPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.RegExpPrototype; +pub extern fn JSC__JSGlobalObject__setIteratorPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.SetIteratorPrototype; +pub extern fn JSC__JSGlobalObject__startRemoteInspector(arg0: ?*JSC__JSGlobalObject, arg1: [*c]u8, arg2: u16) bool; +pub extern fn JSC__JSGlobalObject__stringPrototype(arg0: ?*JSC__JSGlobalObject) ?*bindings.StringPrototype; +pub extern fn JSC__JSGlobalObject__symbolPrototype(arg0: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSGlobalObject__vm(arg0: ?*JSC__JSGlobalObject) [*c]JSC__VM; pub extern fn WTF__URL__encodedPassword(arg0: [*c]WTF__URL) bWTF__StringView; pub extern fn WTF__URL__encodedUser(arg0: [*c]WTF__URL) bWTF__StringView; pub extern fn WTF__URL__fileSystemPath(arg0: [*c]WTF__URL) bWTF__String; @@ -312,44 +254,42 @@ pub extern fn WTF__String__isEmpty(arg0: [*c]WTF__String) bool; pub extern fn WTF__String__isExternal(arg0: [*c]WTF__String) bool; pub extern fn WTF__String__isStatic(arg0: [*c]WTF__String) bool; pub extern fn WTF__String__length(arg0: [*c]WTF__String) usize; -pub extern fn JSC__JSValue___then(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, [*c]JSC__JSGlobalObject, ?*JSC__CallFrame) callconv(.C) void, ArgFn4: ?fn (?*anyopaque, [*c]JSC__JSGlobalObject, ?*JSC__CallFrame) callconv(.C) void) void; -pub extern fn JSC__JSValue__asArrayBuffer_(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]Bun__ArrayBuffer) bool; +pub extern fn JSC__JSValue___then(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn (?*anyopaque, ?*JSC__JSGlobalObject, ?*bindings.CallFrame) callconv(.C) void, ArgFn4: ?fn (?*anyopaque, ?*JSC__JSGlobalObject, ?*bindings.CallFrame) callconv(.C) void) void; +pub extern fn JSC__JSValue__asArrayBuffer_(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: ?*Bun__ArrayBuffer) bool; pub extern fn JSC__JSValue__asCell(JSValue0: JSC__JSValue) [*c]JSC__JSCell; pub extern fn JSC__JSValue__asInternalPromise(JSValue0: JSC__JSValue) [*c]JSC__JSInternalPromise; pub extern fn JSC__JSValue__asNumber(JSValue0: JSC__JSValue) f64; pub extern fn JSC__JSValue__asObject(JSValue0: JSC__JSValue) bJSC__JSObject; pub extern fn JSC__JSValue__asPromise(JSValue0: JSC__JSValue) [*c]JSC__JSPromise; pub extern fn JSC__JSValue__asString(JSValue0: JSC__JSValue) [*c]JSC__JSString; -pub extern fn JSC__JSValue__createEmptyObject(arg0: [*c]JSC__JSGlobalObject, arg1: usize) JSC__JSValue; -pub extern fn JSC__JSValue__createInternalPromise(arg0: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__createObject2(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const ZigString, arg2: [*c]const ZigString, JSValue3: JSC__JSValue, JSValue4: JSC__JSValue) JSC__JSValue; -pub extern fn JSC__JSValue__createRangeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__createStringArray(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]ZigString, arg2: usize, arg3: bool) JSC__JSValue; -pub extern fn JSC__JSValue__createTypeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__createUninitializedUint8Array(arg0: [*c]JSC__JSGlobalObject, arg1: usize) JSC__JSValue; +pub extern fn JSC__JSValue__createEmptyObject(arg0: ?*JSC__JSGlobalObject, arg1: usize) JSC__JSValue; +pub extern fn JSC__JSValue__createInternalPromise(arg0: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createObject2(arg0: ?*JSC__JSGlobalObject, arg1: [*c]const ZigString, arg2: [*c]const ZigString, JSValue3: JSC__JSValue, JSValue4: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSValue__createRangeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createStringArray(arg0: ?*JSC__JSGlobalObject, arg1: [*c]ZigString, arg2: usize, arg3: bool) JSC__JSValue; +pub extern fn JSC__JSValue__createTypeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createUninitializedUint8Array(arg0: ?*JSC__JSGlobalObject, arg1: usize) JSC__JSValue; pub extern fn JSC__JSValue__eqlCell(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSCell) bool; pub extern fn JSC__JSValue__eqlValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) bool; -pub extern fn JSC__JSValue__forEach(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn ([*c]JSC__VM, [*c]JSC__JSGlobalObject, ?*anyopaque, JSC__JSValue) callconv(.C) void) void; -pub extern fn JSC__JSValue__fromEntries(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]ZigString, arg2: [*c]ZigString, arg3: usize, arg4: bool) JSC__JSValue; -pub extern fn JSC__JSValue__fromInt64NoTruncate(arg0: [*c]JSC__JSGlobalObject, arg1: i64) JSC__JSValue; -pub extern fn JSC__JSValue__fromUInt64NoTruncate(arg0: [*c]JSC__JSGlobalObject, arg1: u64) JSC__JSValue; -pub extern fn JSC__JSValue__getClassName(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString) void; -pub extern fn JSC__JSValue__getErrorsProperty(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__getIfPropertyExistsImpl(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]const u8, arg3: u32) JSC__JSValue; -pub extern fn JSC__JSValue__getLengthOfArray(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) u32; -pub extern fn JSC__JSValue__getNameProperty(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString) void; -pub extern fn JSC__JSValue__getPrototype(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__getReadableStreamState(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) [*c]Bun__Readable; -pub extern fn JSC__JSValue__getSymbolDescription(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString) void; -pub extern fn JSC__JSValue__getWritableStreamState(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) [*c]Bun__Writable; -pub extern fn JSC__JSValue__isAggregateError(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) bool; +pub extern fn JSC__JSValue__forEach(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?fn ([*c]JSC__VM, ?*JSC__JSGlobalObject, ?*anyopaque, JSC__JSValue) callconv(.C) void) void; +pub extern fn JSC__JSValue__fromEntries(arg0: ?*JSC__JSGlobalObject, arg1: [*c]ZigString, arg2: [*c]ZigString, arg3: usize, arg4: bool) JSC__JSValue; +pub extern fn JSC__JSValue__fromInt64NoTruncate(arg0: ?*JSC__JSGlobalObject, arg1: i64) JSC__JSValue; +pub extern fn JSC__JSValue__fromUInt64NoTruncate(arg0: ?*JSC__JSGlobalObject, arg1: u64) JSC__JSValue; +pub extern fn JSC__JSValue__getClassName(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__getErrorsProperty(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__getIfPropertyExistsImpl(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]const u8, arg3: u32) JSC__JSValue; +pub extern fn JSC__JSValue__getLengthOfArray(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) u32; +pub extern fn JSC__JSValue__getNameProperty(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__getPrototype(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__getSymbolDescription(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__isAggregateError(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) bool; pub extern fn JSC__JSValue__isAnyInt(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isBigInt(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isBigInt32(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isBoolean(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isCallable(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) bool; pub extern fn JSC__JSValue__isCell(JSValue0: JSC__JSValue) bool; -pub extern fn JSC__JSValue__isClass(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) bool; +pub extern fn JSC__JSValue__isClass(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) bool; pub extern fn JSC__JSValue__isCustomGetterSetter(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isError(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isException(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) bool; @@ -357,11 +297,11 @@ pub extern fn JSC__JSValue__isGetterSetter(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isHeapBigInt(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isInt32(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isInt32AsAnyInt(JSValue0: JSC__JSValue) bool; -pub extern fn JSC__JSValue__isIterable(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) bool; +pub extern fn JSC__JSValue__isIterable(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) bool; pub extern fn JSC__JSValue__isNumber(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isObject(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isPrimitive(JSValue0: JSC__JSValue) bool; -pub extern fn JSC__JSValue__isSameValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: [*c]JSC__JSGlobalObject) bool; +pub extern fn JSC__JSValue__isSameValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: ?*JSC__JSGlobalObject) bool; pub extern fn JSC__JSValue__isString(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isSymbol(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__isTerminationException(JSValue0: JSC__JSValue, arg1: [*c]JSC__VM) bool; @@ -373,40 +313,40 @@ pub extern fn JSC__JSValue__jsNumberFromChar(arg0: u8) JSC__JSValue; pub extern fn JSC__JSValue__jsNumberFromDouble(arg0: f64) JSC__JSValue; pub extern fn JSC__JSValue__jsNumberFromInt64(arg0: i64) JSC__JSValue; pub extern fn JSC__JSValue__jsNumberFromU16(arg0: u16) JSC__JSValue; -pub extern fn JSC__JSValue__jsonStringify(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: u32, arg3: [*c]ZigString) void; +pub extern fn JSC__JSValue__jsonStringify(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: u32, arg3: [*c]ZigString) void; pub extern fn JSC__JSValue__jsTDZValue(...) JSC__JSValue; pub extern fn JSC__JSValue__jsType(JSValue0: JSC__JSValue) u8; pub extern fn JSC__JSValue__jsUndefined(...) JSC__JSValue; -pub extern fn JSC__JSValue__makeWithNameAndPrototype(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque, arg2: ?*anyopaque, arg3: [*c]const ZigString) JSC__JSValue; -pub extern fn JSC__JSValue__parseJSON(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__put(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]const ZigString, JSValue3: JSC__JSValue) void; -pub extern fn JSC__JSValue__putRecord(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; -pub extern fn JSC__JSValue__symbolFor(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; -pub extern fn JSC__JSValue__symbolKeyFor(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigString) bool; +pub extern fn JSC__JSValue__makeWithNameAndPrototype(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque, arg2: ?*anyopaque, arg3: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSValue__parseJSON(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__put(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]const ZigString, JSValue3: JSC__JSValue) void; +pub extern fn JSC__JSValue__putRecord(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; +pub extern fn JSC__JSValue__symbolFor(arg0: ?*JSC__JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; +pub extern fn JSC__JSValue__symbolKeyFor(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigString) bool; pub extern fn JSC__JSValue__toBoolean(JSValue0: JSC__JSValue) bool; pub extern fn JSC__JSValue__toInt32(JSValue0: JSC__JSValue) i32; pub extern fn JSC__JSValue__toInt64(JSValue0: JSC__JSValue) i64; -pub extern fn JSC__JSValue__toObject(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject; -pub extern fn JSC__JSValue__toPropertyKey(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) bJSC__Identifier; -pub extern fn JSC__JSValue__toPropertyKeyValue(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn JSC__JSValue__toString(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) [*c]JSC__JSString; -pub extern fn JSC__JSValue__toStringOrNull(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) [*c]JSC__JSString; +pub extern fn JSC__JSValue__toObject(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) [*c]JSC__JSObject; +pub extern fn JSC__JSValue__toPropertyKey(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) bJSC__Identifier; +pub extern fn JSC__JSValue__toPropertyKeyValue(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__toString(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) [*c]JSC__JSString; +pub extern fn JSC__JSValue__toStringOrNull(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) [*c]JSC__JSString; pub extern fn JSC__JSValue__toUInt64NoTruncate(JSValue0: JSC__JSValue) u64; -pub extern fn JSC__JSValue__toWTFString(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject) bWTF__String; -pub extern fn JSC__JSValue__toZigException(JSValue0: JSC__JSValue, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]ZigException) void; -pub extern fn JSC__JSValue__toZigString(JSValue0: JSC__JSValue, arg1: [*c]ZigString, arg2: [*c]JSC__JSGlobalObject) void; +pub extern fn JSC__JSValue__toWTFString(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject) bWTF__String; +pub extern fn JSC__JSValue__toZigException(JSValue0: JSC__JSValue, arg1: ?*JSC__JSGlobalObject, arg2: [*c]ZigException) void; +pub extern fn JSC__JSValue__toZigString(JSValue0: JSC__JSValue, arg1: [*c]ZigString, arg2: ?*JSC__JSGlobalObject) void; pub extern fn JSC__PropertyName__eqlToIdentifier(arg0: [*c]JSC__PropertyName, arg1: [*c]const JSC__Identifier) bool; pub extern fn JSC__PropertyName__eqlToPropertyName(arg0: [*c]JSC__PropertyName, arg1: [*c]const JSC__PropertyName) bool; pub extern fn JSC__PropertyName__publicName(arg0: [*c]JSC__PropertyName) [*c]const WTF__StringImpl; pub extern fn JSC__PropertyName__uid(arg0: [*c]JSC__PropertyName) [*c]const WTF__StringImpl; -pub extern fn JSC__Exception__create(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]JSC__JSObject, StackCaptureAction2: u8) [*c]JSC__Exception; +pub extern fn JSC__Exception__create(arg0: ?*JSC__JSGlobalObject, arg1: [*c]JSC__JSObject, StackCaptureAction2: u8) [*c]JSC__Exception; pub extern fn JSC__Exception__getStackTrace(arg0: [*c]JSC__Exception, arg1: [*c]ZigStackTrace) void; pub extern fn JSC__Exception__value(arg0: [*c]JSC__Exception) JSC__JSValue; pub extern fn JSC__VM__clearExecutionTimeLimit(arg0: [*c]JSC__VM) void; pub extern fn JSC__VM__create(HeapType0: u8) [*c]JSC__VM; pub extern fn JSC__VM__deferGC(arg0: [*c]JSC__VM, arg1: ?*anyopaque, ArgFn2: ?fn (?*anyopaque) callconv(.C) void) void; -pub extern fn JSC__VM__deinit(arg0: [*c]JSC__VM, arg1: [*c]JSC__JSGlobalObject) void; -pub extern fn JSC__VM__deleteAllCode(arg0: [*c]JSC__VM, arg1: [*c]JSC__JSGlobalObject) void; +pub extern fn JSC__VM__deinit(arg0: [*c]JSC__VM, arg1: ?*JSC__JSGlobalObject) void; +pub extern fn JSC__VM__deleteAllCode(arg0: [*c]JSC__VM, arg1: ?*JSC__JSGlobalObject) void; pub extern fn JSC__VM__doWork(arg0: [*c]JSC__VM) void; pub extern fn JSC__VM__drainMicrotasks(arg0: [*c]JSC__VM) void; pub extern fn JSC__VM__executionForbidden(arg0: [*c]JSC__VM) bool; @@ -418,7 +358,7 @@ pub extern fn JSC__VM__runGC(arg0: [*c]JSC__VM, arg1: bool) JSC__JSValue; pub extern fn JSC__VM__setExecutionForbidden(arg0: [*c]JSC__VM, arg1: bool) void; pub extern fn JSC__VM__setExecutionTimeLimit(arg0: [*c]JSC__VM, arg1: f64) void; pub extern fn JSC__VM__shrinkFootprint(arg0: [*c]JSC__VM) void; -pub extern fn JSC__VM__throwError(arg0: [*c]JSC__VM, arg1: [*c]JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__VM__throwError(arg0: [*c]JSC__VM, arg1: ?*JSC__JSGlobalObject, JSValue2: JSC__JSValue) void; pub extern fn JSC__VM__whenIdle(arg0: [*c]JSC__VM, ArgFn1: ?fn (...) callconv(.C) void) void; pub extern fn JSC__ThrowScope__clearException(arg0: [*c]JSC__ThrowScope) void; pub extern fn JSC__ThrowScope__declare(arg0: [*c]JSC__VM, arg1: [*c]u8, arg2: [*c]u8, arg3: usize) bJSC__ThrowScope; @@ -463,28 +403,26 @@ pub extern fn WTF__StringView__is16Bit(arg0: [*c]const WTF__StringView) bool; pub extern fn WTF__StringView__is8Bit(arg0: [*c]const WTF__StringView) bool; pub extern fn WTF__StringView__isEmpty(arg0: [*c]const WTF__StringView) bool; pub extern fn WTF__StringView__length(arg0: [*c]const WTF__StringView) usize; -pub extern fn Zig__GlobalObject__create(arg0: [*c]JSClassRef, arg1: i32, arg2: ?*anyopaque) [*c]JSC__JSGlobalObject; -pub extern fn Zig__GlobalObject__getModuleRegistryMap(arg0: [*c]JSC__JSGlobalObject) ?*anyopaque; -pub extern fn Zig__GlobalObject__resetModuleRegistryMap(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque) bool; -pub extern fn Bun__Readable__create(arg0: [*c]Bun__Readable, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn Bun__Writable__create(arg0: [*c]Bun__Writable, arg1: [*c]JSC__JSGlobalObject) JSC__JSValue; -pub extern fn Bun__Path__create(arg0: [*c]JSC__JSGlobalObject, arg1: bool) JSC__JSValue; -pub extern fn ArrayBufferSink__assignToStream(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern fn ArrayBufferSink__createObject(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn Zig__GlobalObject__create(arg0: [*c]JSClassRef, arg1: i32, arg2: ?*anyopaque) ?*JSC__JSGlobalObject; +pub extern fn Zig__GlobalObject__getModuleRegistryMap(arg0: ?*JSC__JSGlobalObject) ?*anyopaque; +pub extern fn Zig__GlobalObject__resetModuleRegistryMap(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque) bool; +pub extern fn Bun__Path__create(arg0: ?*JSC__JSGlobalObject, arg1: bool) JSC__JSValue; +pub extern fn ArrayBufferSink__assignToStream(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn ArrayBufferSink__createObject(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; pub extern fn ArrayBufferSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern fn ArrayBufferSink__fromJS(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn ArrayBufferSink__fromJS(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; pub extern fn ArrayBufferSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; pub extern fn ArrayBufferSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern fn HTTPSResponseSink__assignToStream(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern fn HTTPSResponseSink__createObject(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn HTTPSResponseSink__assignToStream(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn HTTPSResponseSink__createObject(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; pub extern fn HTTPSResponseSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern fn HTTPSResponseSink__fromJS(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn HTTPSResponseSink__fromJS(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; pub extern fn HTTPSResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; pub extern fn HTTPSResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern fn HTTPResponseSink__assignToStream(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern fn HTTPResponseSink__createObject(arg0: [*c]JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn HTTPResponseSink__assignToStream(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn HTTPResponseSink__createObject(arg0: ?*JSC__JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; pub extern fn HTTPResponseSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern fn HTTPResponseSink__fromJS(arg0: [*c]JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn HTTPResponseSink__fromJS(arg0: ?*JSC__JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; pub extern fn HTTPResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; pub extern fn HTTPResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern fn ZigException__fromException(arg0: [*c]JSC__Exception) ZigException;
\ No newline at end of file +pub extern fn ZigException__fromException(arg0: [*c]JSC__Exception) ZigException; diff --git a/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp b/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp index 3b24d0a8a..670cac93e 100644 --- a/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp +++ b/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp @@ -55,8 +55,8 @@ EventTarget* JSEventTarget::toWrapped(VM& vm, JSValue value) // return &jsCast<JSWindowProxy*>(asObject(value))->wrapped(); // if (value.inherits<JSDOMWindow>()) // return &jsCast<JSDOMWindow*>(asObject(value))->wrapped(); - // if (value.inherits<JSWorkerGlobalScope>()) - // return &jsCast<JSWorkerGlobalScope*>(asObject(value))->wrapped(); + // if (value.inherits<JSDOMGlobalObject>()) + // return &jsCast<JSDOMGlobalObject*>(asObject(value))->wrapped(); if (value.inherits<JSEventTarget>()) return &jsCast<JSEventTarget*>(asObject(value))->wrapped(); return nullptr; @@ -66,8 +66,8 @@ std::unique_ptr<JSEventTargetWrapper> jsEventTargetCast(VM& vm, JSValue thisValu { if (auto* target = jsDynamicCast<JSEventTarget*>(thisValue)) return makeUnique<JSEventTargetWrapper>(target->wrapped(), *target); - // if (auto* window = toJSDOMGlobalObject<JSDOMWindow>(vm, thisValue)) - // return makeUnique<JSEventTargetWrapper>(window->wrapped(), *window); + // if (auto* window = toJSDOMGlobalObject<JSDOMGlobalObject>(vm, thisValue)) + // return makeUnique<JSEventTargetWrapper>(*window, *window); // if (auto* scope = toJSDOMGlobalObject<JSWorkerGlobalScope>(vm, thisValue)) // return makeUnique<JSEventTargetWrapper>(scope->wrapped(), *scope); return nullptr; diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp index a0198713d..fd6010f17 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp @@ -949,26 +949,34 @@ const char* const s_readableStreamInternalsIsReadableStreamDefaultControllerCode const JSC::ConstructAbility s_readableStreamInternalsReadDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const int s_readableStreamInternalsReadDirectStreamCodeLength = 1124; +const int s_readableStreamInternalsReadDirectStreamCodeLength = 1208; static const JSC::Intrinsic s_readableStreamInternalsReadDirectStreamCodeIntrinsic = JSC::NoIntrinsic; const char* const s_readableStreamInternalsReadDirectStreamCode = "(function (stream, sink, underlyingSource) {\n" \ " \"use strict\";\n" \ + " \n" \ + " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ + "\n" \ + " var {close: originalClose, pull} = underlyingSource;\n" \ + " underlyingSource = @undefined;\n" \ + "\n" \ "\n" \ - " var originalClose = underlyingSource.close;\n" \ - " var reader;\n" \ + " var fakeReader = {\n" \ + " };\n" \ " var close = (reason) => {\n" \ - " originalClose && originalClose(reason);\n" \ " try {\n" \ - " reader && reader.releaseLock();\n" \ - " } catch (e) {}\n" \ - " @readableStreamClose(stream, reason);\n" \ - " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ + " originalClose && originalClose(reason);\n" \ + " } catch (e) {\n" \ + "\n" \ + " }\n" \ + " originalClose = @undefined;\n" \ + " @putByIdDirectPrivate(stream, \"reader\", @undefined);\n" \ " @putByIdDirectPrivate(stream, \"readableStreamController\", null);\n" \ - " close = @undefined;\n" \ - " reader = @undefined;\n" \ + " @putByIdDirectPrivate(stream, \"state\", @streamClosed);\n" \ + " stream = @undefined;\n" \ + " fakeReader = @undefined;\n" \ " };\n" \ - " var pull = underlyingSource.pull;\n" \ + "\n" \ "\n" \ " if (!pull) {\n" \ " close();\n" \ @@ -983,7 +991,6 @@ const char* const s_readableStreamInternalsReadDirectStreamCode = "\n" \ " @putByIdDirectPrivate(stream, \"readableStreamController\", sink);\n" \ " @putByIdDirectPrivate(stream, \"start\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ "\n" \ " const highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n" \ "\n" \ @@ -996,9 +1003,9 @@ const char* const s_readableStreamInternalsReadDirectStreamCode = " @startDirectStream.@call(sink, stream, pull, close);\n" \ "\n" \ " //\n" \ - " reader = stream.getReader();\n" \ - "\n" \ + " @putByIdDirectPrivate(stream, \"reader\", fakeReader);\n" \ " pull(sink);\n" \ + " sink = @undefined;\n" \ "})\n" \ ; @@ -1165,7 +1172,7 @@ const char* const s_readableStreamInternalsHandleDirectStreamErrorCode = " }\n" \ "\n" \ " this.error =\n" \ - " this.drain =\n" \ + " this.flush =\n" \ " this.write =\n" \ " this.close =\n" \ " this.end =\n" \ @@ -1220,9 +1227,9 @@ const char* const s_readableStreamInternalsOnPullDirectStreamCode = " }\n" \ "\n" \ " controller._deferClose = -1;\n" \ - " controller._deferDrain = -1;\n" \ + " controller._deferFlush = -1;\n" \ " var deferClose;\n" \ - " var deferDrain;\n" \ + " var deferFlush;\n" \ "\n" \ " //\n" \ " //\n" \ @@ -1245,8 +1252,8 @@ const char* const s_readableStreamInternalsOnPullDirectStreamCode = " return @handleDirectStreamErrorReject.@call(controller, e);\n" \ " } finally {\n" \ " deferClose = controller._deferClose;\n" \ - " deferDrain = controller._deferDrain;\n" \ - " controller._deferDrain = controller._deferClose = 0;\n" \ + " deferFlush = controller._deferFlush;\n" \ + " controller._deferFlush = controller._deferClose = 0;\n" \ " }\n" \ "\n" \ " var promiseToReturn;\n" \ @@ -1267,8 +1274,8 @@ const char* const s_readableStreamInternalsOnPullDirectStreamCode = " }\n" \ "\n" \ " //\n" \ - " if (deferDrain === 1) {\n" \ - " @onDrainDirectStream.@call(controller);\n" \ + " if (deferFlush === 1) {\n" \ + " @onFlushDirectStream.@call(controller);\n" \ " }\n" \ "\n" \ " return promiseToReturn;\n" \ @@ -1320,9 +1327,9 @@ const char* const s_readableStreamInternalsOnCloseDirectStreamCode = " } catch (e) {}\n" \ " }\n" \ "\n" \ - " var drained;\n" \ + " var flushed;\n" \ " try {\n" \ - " drained = this.@sink.end();\n" \ + " flushed = this.@sink.end();\n" \ " @putByIdDirectPrivate(this, \"sink\", @undefined);\n" \ " } catch (e) {\n" \ " if (this._pendingRead) {\n" \ @@ -1335,7 +1342,7 @@ const char* const s_readableStreamInternalsOnCloseDirectStreamCode = " }\n" \ "\n" \ " this.error =\n" \ - " this.drain =\n" \ + " this.flush =\n" \ " this.write =\n" \ " this.close =\n" \ " this.end =\n" \ @@ -1345,18 +1352,18 @@ const char* const s_readableStreamInternalsOnCloseDirectStreamCode = "\n" \ " if (reader && @isReadableStreamDefaultReader(reader)) {\n" \ " var _pendingRead = this._pendingRead;\n" \ - " if (_pendingRead && @isPromise(_pendingRead) && drained?.byteLength) {\n" \ + " if (_pendingRead && @isPromise(_pendingRead) && flushed?.byteLength) {\n" \ " this._pendingRead = @undefined;\n" \ - " @fulfillPromise(_pendingRead, { value: drained, done: false });\n" \ + " @fulfillPromise(_pendingRead, { value: flushed, done: false });\n" \ " @readableStreamClose(stream);\n" \ " return;\n" \ " }\n" \ " }\n" \ "\n" \ - " if (drained?.byteLength) {\n" \ + " if (flushed?.byteLength) {\n" \ " var requests = @getByIdDirectPrivate(reader, \"readRequests\");\n" \ " if (requests?.isNotEmpty()) {\n" \ - " @readableStreamFulfillReadRequest(stream, drained, false);\n" \ + " @readableStreamFulfillReadRequest(stream, flushed, false);\n" \ " @readableStreamClose(stream);\n" \ " return;\n" \ " }\n" \ @@ -1364,10 +1371,10 @@ const char* const s_readableStreamInternalsOnCloseDirectStreamCode = " @putByIdDirectPrivate(stream, \"state\", @streamReadable);\n" \ " this.@pull = () => {\n" \ " var thisResult = @createFulfilledPromise({\n" \ - " value: drained,\n" \ + " value: flushed,\n" \ " done: false,\n" \ " });\n" \ - " drained = @undefined;\n" \ + " flushed = @undefined;\n" \ " @readableStreamClose(stream);\n" \ " stream = @undefined;\n" \ " return thisResult;\n" \ @@ -1383,11 +1390,11 @@ const char* const s_readableStreamInternalsOnCloseDirectStreamCode = "})\n" \ ; -const JSC::ConstructAbility s_readableStreamInternalsOnDrainDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnDrainDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const int s_readableStreamInternalsOnDrainDirectStreamCodeLength = 929; -static const JSC::Intrinsic s_readableStreamInternalsOnDrainDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnDrainDirectStreamCode = +const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; +const int s_readableStreamInternalsOnFlushDirectStreamCodeLength = 929; +static const JSC::Intrinsic s_readableStreamInternalsOnFlushDirectStreamCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_readableStreamInternalsOnFlushDirectStreamCode = "(function () {\n" \ " \"use strict\";\n" \ "\n" \ @@ -1400,23 +1407,23 @@ const char* const s_readableStreamInternalsOnDrainDirectStreamCode = " var _pendingRead = this._pendingRead;\n" \ " this._pendingRead = @undefined;\n" \ " if (_pendingRead && @isPromise(_pendingRead)) {\n" \ - " var drained = this.@sink.drain();\n" \ - " if (drained?.byteLength) {\n" \ + " var flushed = this.@sink.flush();\n" \ + " if (flushed?.byteLength) {\n" \ " this._pendingRead = @getByIdDirectPrivate(\n" \ " stream,\n" \ " \"readRequests\"\n" \ " )?.shift();\n" \ - " @fulfillPromise(_pendingRead, { value: drained, done: false });\n" \ + " @fulfillPromise(_pendingRead, { value: flushed, done: false });\n" \ " } else {\n" \ " this._pendingRead = _pendingRead;\n" \ " }\n" \ " } else if (@getByIdDirectPrivate(stream, \"readRequests\")?.isNotEmpty()) {\n" \ - " var drained = this.@sink.drain();\n" \ - " if (drained?.byteLength) {\n" \ - " @readableStreamFulfillReadRequest(stream, drained, false);\n" \ + " var flushed = this.@sink.flush();\n" \ + " if (flushed?.byteLength) {\n" \ + " @readableStreamFulfillReadRequest(stream, flushed, false);\n" \ " }\n" \ - " } else if (this._deferDrain === -1) {\n" \ - " this._deferDrain = 1;\n" \ + " } else if (this._deferFlush === -1) {\n" \ + " this._deferFlush = 1;\n" \ " }\n" \ "})\n" \ ; @@ -1474,7 +1481,7 @@ const char* const s_readableStreamInternalsCreateTextStreamCode = " return byteLength;\n" \ " },\n" \ "\n" \ - " drain() {\n" \ + " flush() {\n" \ " return 0;\n" \ " },\n" \ "\n" \ @@ -1561,10 +1568,10 @@ const char* const s_readableStreamInternalsInitializeTextStreamCode = " error: @handleDirectStreamError,\n" \ " end: @onCloseDirectStream,\n" \ " @close: @onCloseDirectStream,\n" \ - " drain: @onDrainDirectStream,\n" \ + " flush: @onFlushDirectStream,\n" \ " _pendingRead: @undefined,\n" \ " _deferClose: 0,\n" \ - " _deferDrain: 0,\n" \ + " _deferFlush: 0,\n" \ " _deferCloseReason: @undefined,\n" \ " _handleError: @undefined,\n" \ " };\n" \ @@ -1601,7 +1608,7 @@ const char* const s_readableStreamInternalsInitializeArrayStreamCode = " return chunk.byteLength || chunk.length;\n" \ " },\n" \ "\n" \ - " drain() {\n" \ + " flush() {\n" \ " return 0;\n" \ " },\n" \ "\n" \ @@ -1629,10 +1636,10 @@ const char* const s_readableStreamInternalsInitializeArrayStreamCode = " error: @handleDirectStreamError,\n" \ " end: @onCloseDirectStream,\n" \ " @close: @onCloseDirectStream,\n" \ - " drain: @onDrainDirectStream,\n" \ + " flush: @onFlushDirectStream,\n" \ " _pendingRead: @undefined,\n" \ " _deferClose: 0,\n" \ - " _deferDrain: 0,\n" \ + " _deferFlush: 0,\n" \ " _deferCloseReason: @undefined,\n" \ " _handleError: @undefined,\n" \ " };\n" \ @@ -1673,10 +1680,10 @@ const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode = " error: @handleDirectStreamError,\n" \ " end: @onCloseDirectStream,\n" \ " @close: @onCloseDirectStream,\n" \ - " drain: @onDrainDirectStream,\n" \ + " flush: @onFlushDirectStream,\n" \ " _pendingRead: @undefined,\n" \ " _deferClose: 0,\n" \ - " _deferDrain: 0,\n" \ + " _deferFlush: 0,\n" \ " _deferCloseReason: @undefined,\n" \ " _handleError: @undefined,\n" \ " };\n" \ @@ -2163,7 +2170,7 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanClo const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind = JSC::ConstructorKind::None; -const int s_readableStreamInternalsLazyLoadStreamCodeLength = 2511; +const int s_readableStreamInternalsLazyLoadStreamCodeLength = 2505; static const JSC::Intrinsic s_readableStreamInternalsLazyLoadStreamCodeIntrinsic = JSC::NoIntrinsic; const char* const s_readableStreamInternalsLazyLoadStreamCode = "(function (stream, autoAllocateChunkSize) {\n" \ @@ -2171,8 +2178,7 @@ const char* const s_readableStreamInternalsLazyLoadStreamCode = "\n" \ " var nativeType = @getByIdDirectPrivate(stream, \"bunNativeType\");\n" \ " var nativePtr = @getByIdDirectPrivate(stream, \"bunNativePtr\");\n" \ - " var cached = @lazyStreamPrototypeMap;\n" \ - " var Prototype = cached.@get(nativeType);\n" \ + " var Prototype = @lazyStreamPrototypeMap.@get(nativeType);\n" \ " if (Prototype === @undefined) {\n" \ " var [pull, start, cancel, setClose, deinit] = @lazyLoad(nativeType);\n" \ " var closer = [false];\n" \ @@ -2245,7 +2251,7 @@ const char* const s_readableStreamInternalsLazyLoadStreamCode = " static deinit = deinit;\n" \ " static registry = new FinalizationRegistry(deinit);\n" \ " };\n" \ - " cached.@set(nativeType, Prototype);\n" \ + " @lazyStreamPrototypeMap.@set(nativeType, Prototype);\n" \ " }\n" \ "\n" \ " const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize);\n" \ @@ -2355,7 +2361,7 @@ const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode " @fulfillPromise(capability.@promise, sink.end());\n" \ " }\n" \ " },\n" \ - " drain() {\n" \ + " flush() {\n" \ " return 0;\n" \ " },\n" \ " write: sink.write.bind(sink),\n" \ diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h index ff0730131..533e6558b 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h @@ -183,10 +183,10 @@ extern const char* const s_readableStreamInternalsOnCloseDirectStreamCode; extern const int s_readableStreamInternalsOnCloseDirectStreamCodeLength; extern const JSC::ConstructAbility s_readableStreamInternalsOnCloseDirectStreamCodeConstructAbility; extern const JSC::ConstructorKind s_readableStreamInternalsOnCloseDirectStreamCodeConstructorKind; -extern const char* const s_readableStreamInternalsOnDrainDirectStreamCode; -extern const int s_readableStreamInternalsOnDrainDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnDrainDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnDrainDirectStreamCodeConstructorKind; +extern const char* const s_readableStreamInternalsOnFlushDirectStreamCode; +extern const int s_readableStreamInternalsOnFlushDirectStreamCodeLength; +extern const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility; +extern const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind; extern const char* const s_readableStreamInternalsCreateTextStreamCode; extern const int s_readableStreamInternalsCreateTextStreamCodeLength; extern const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility; @@ -335,7 +335,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArray macro(noopDoneFunction, readableStreamInternalsNoopDoneFunction, 0) \ macro(onReadableStreamDirectControllerClosed, readableStreamInternalsOnReadableStreamDirectControllerClosed, 1) \ macro(onCloseDirectStream, readableStreamInternalsOnCloseDirectStream, 1) \ - macro(onDrainDirectStream, readableStreamInternalsOnDrainDirectStream, 0) \ + macro(onFlushDirectStream, readableStreamInternalsOnFlushDirectStream, 0) \ macro(createTextStream, readableStreamInternalsCreateTextStream, 1) \ macro(initializeTextStream, readableStreamInternalsInitializeTextStream, 2) \ macro(initializeArrayStream, readableStreamInternalsInitializeArrayStream, 2) \ @@ -399,7 +399,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArray #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_NOOPDONEFUNCTION 1 #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONREADABLESTREAMDIRECTCONTROLLERCLOSED 1 #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONCLOSEDIRECTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONDRAINDIRECTSTREAM 1 +#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONFLUSHDIRECTSTREAM 1 #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_CREATETEXTSTREAM 1 #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZETEXTSTREAM 1 #define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZEARRAYSTREAM 1 @@ -464,7 +464,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArray macro(readableStreamInternalsNoopDoneFunctionCode, noopDoneFunction, ASCIILiteral(), s_readableStreamInternalsNoopDoneFunctionCodeLength) \ macro(readableStreamInternalsOnReadableStreamDirectControllerClosedCode, onReadableStreamDirectControllerClosed, ASCIILiteral(), s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength) \ macro(readableStreamInternalsOnCloseDirectStreamCode, onCloseDirectStream, ASCIILiteral(), s_readableStreamInternalsOnCloseDirectStreamCodeLength) \ - macro(readableStreamInternalsOnDrainDirectStreamCode, onDrainDirectStream, ASCIILiteral(), s_readableStreamInternalsOnDrainDirectStreamCodeLength) \ + macro(readableStreamInternalsOnFlushDirectStreamCode, onFlushDirectStream, ASCIILiteral(), s_readableStreamInternalsOnFlushDirectStreamCodeLength) \ macro(readableStreamInternalsCreateTextStreamCode, createTextStream, ASCIILiteral(), s_readableStreamInternalsCreateTextStreamCodeLength) \ macro(readableStreamInternalsInitializeTextStreamCode, initializeTextStream, ASCIILiteral(), s_readableStreamInternalsInitializeTextStreamCodeLength) \ macro(readableStreamInternalsInitializeArrayStreamCode, initializeArrayStream, ASCIILiteral(), s_readableStreamInternalsInitializeArrayStreamCodeLength) \ @@ -512,7 +512,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArray macro(lazyLoadStream) \ macro(noopDoneFunction) \ macro(onCloseDirectStream) \ - macro(onDrainDirectStream) \ + macro(onFlushDirectStream) \ macro(onPullDirectStream) \ macro(onReadableStreamDirectControllerClosed) \ macro(pipeToClosingMustBePropagatedBackward) \ diff --git a/src/bun.js/builtins/js/ReadableStreamInternals.js b/src/bun.js/builtins/js/ReadableStreamInternals.js index c959f24fa..353e3f9e9 100644 --- a/src/bun.js/builtins/js/ReadableStreamInternals.js +++ b/src/bun.js/builtins/js/ReadableStreamInternals.js @@ -782,21 +782,29 @@ function isReadableStreamDefaultController(controller) { function readDirectStream(stream, sink, underlyingSource) { "use strict"; + + @putByIdDirectPrivate(stream, "underlyingSource", @undefined); + + var {close: originalClose, pull} = underlyingSource; + underlyingSource = @undefined; + - var originalClose = underlyingSource.close; - var reader; + var fakeReader = { + }; var close = (reason) => { - originalClose && originalClose(reason); try { - reader && reader.releaseLock(); - } catch (e) {} - @readableStreamClose(stream, reason); - @putByIdDirectPrivate(stream, "underlyingSource", @undefined); + originalClose && originalClose(reason); + } catch (e) { + + } + originalClose = @undefined; + @putByIdDirectPrivate(stream, "reader", @undefined); @putByIdDirectPrivate(stream, "readableStreamController", null); - close = @undefined; - reader = @undefined; + @putByIdDirectPrivate(stream, "state", @streamClosed); + stream = @undefined; + fakeReader = @undefined; }; - var pull = underlyingSource.pull; + if (!pull) { close(); @@ -811,7 +819,6 @@ function readDirectStream(stream, sink, underlyingSource) { @putByIdDirectPrivate(stream, "readableStreamController", sink); @putByIdDirectPrivate(stream, "start", @undefined); - @putByIdDirectPrivate(stream, "underlyingSource", @undefined); const highWaterMark = @getByIdDirectPrivate(stream, "highWaterMark"); @@ -823,10 +830,10 @@ function readDirectStream(stream, sink, underlyingSource) { @startDirectStream.@call(sink, stream, pull, close); - // lock the stream, relying on close() or end() to eventaully close it - reader = stream.getReader(); - + // isReadableStreamLocked() checks for truthiness of "reader" + @putByIdDirectPrivate(stream, "reader", fakeReader); pull(sink); + sink = @undefined; } @globalPrivate; @@ -976,7 +983,7 @@ function handleDirectStreamError(e) { } this.error = - this.drain = + this.flush = this.write = this.close = this.end = @@ -1019,9 +1026,9 @@ function onPullDirectStream(controller) { } controller._deferClose = -1; - controller._deferDrain = -1; + controller._deferFlush = -1; var deferClose; - var deferDrain; + var deferFlush; // Direct streams allow @pull to be called multiple times, unlike the spec. // Backpressure is handled by the destination, not by the underlying source. @@ -1044,8 +1051,8 @@ function onPullDirectStream(controller) { return @handleDirectStreamErrorReject.@call(controller, e); } finally { deferClose = controller._deferClose; - deferDrain = controller._deferDrain; - controller._deferDrain = controller._deferClose = 0; + deferFlush = controller._deferFlush; + controller._deferFlush = controller._deferClose = 0; } var promiseToReturn; @@ -1065,9 +1072,9 @@ function onPullDirectStream(controller) { return promiseToReturn; } - // not done, but they called drain() - if (deferDrain === 1) { - @onDrainDirectStream.@call(controller); + // not done, but they called flush() + if (deferFlush === 1) { + @onFlushDirectStream.@call(controller); } return promiseToReturn; @@ -1101,9 +1108,9 @@ function onCloseDirectStream(reason) { } catch (e) {} } - var drained; + var flushed; try { - drained = this.@sink.end(); + flushed = this.@sink.end(); @putByIdDirectPrivate(this, "sink", @undefined); } catch (e) { if (this._pendingRead) { @@ -1116,7 +1123,7 @@ function onCloseDirectStream(reason) { } this.error = - this.drain = + this.flush = this.write = this.close = this.end = @@ -1126,18 +1133,18 @@ function onCloseDirectStream(reason) { if (reader && @isReadableStreamDefaultReader(reader)) { var _pendingRead = this._pendingRead; - if (_pendingRead && @isPromise(_pendingRead) && drained?.byteLength) { + if (_pendingRead && @isPromise(_pendingRead) && flushed?.byteLength) { this._pendingRead = @undefined; - @fulfillPromise(_pendingRead, { value: drained, done: false }); + @fulfillPromise(_pendingRead, { value: flushed, done: false }); @readableStreamClose(stream); return; } } - if (drained?.byteLength) { + if (flushed?.byteLength) { var requests = @getByIdDirectPrivate(reader, "readRequests"); if (requests?.isNotEmpty()) { - @readableStreamFulfillReadRequest(stream, drained, false); + @readableStreamFulfillReadRequest(stream, flushed, false); @readableStreamClose(stream); return; } @@ -1145,10 +1152,10 @@ function onCloseDirectStream(reason) { @putByIdDirectPrivate(stream, "state", @streamReadable); this.@pull = () => { var thisResult = @createFulfilledPromise({ - value: drained, + value: flushed, done: false, }); - drained = @undefined; + flushed = @undefined; @readableStreamClose(stream); stream = @undefined; return thisResult; @@ -1163,7 +1170,7 @@ function onCloseDirectStream(reason) { @readableStreamClose(stream); } -function onDrainDirectStream() { +function onFlushDirectStream() { "use strict"; var stream = this.@controlledReadableStream; @@ -1175,23 +1182,23 @@ function onDrainDirectStream() { var _pendingRead = this._pendingRead; this._pendingRead = @undefined; if (_pendingRead && @isPromise(_pendingRead)) { - var drained = this.@sink.drain(); - if (drained?.byteLength) { + var flushed = this.@sink.flush(); + if (flushed?.byteLength) { this._pendingRead = @getByIdDirectPrivate( stream, "readRequests" )?.shift(); - @fulfillPromise(_pendingRead, { value: drained, done: false }); + @fulfillPromise(_pendingRead, { value: flushed, done: false }); } else { this._pendingRead = _pendingRead; } } else if (@getByIdDirectPrivate(stream, "readRequests")?.isNotEmpty()) { - var drained = this.@sink.drain(); - if (drained?.byteLength) { - @readableStreamFulfillReadRequest(stream, drained, false); + var flushed = this.@sink.flush(); + if (flushed?.byteLength) { + @readableStreamFulfillReadRequest(stream, flushed, false); } - } else if (this._deferDrain === -1) { - this._deferDrain = 1; + } else if (this._deferFlush === -1) { + this._deferFlush = 1; } } @@ -1243,7 +1250,7 @@ function createTextStream(highWaterMark) { return byteLength; }, - drain() { + flush() { return 0; }, @@ -1324,10 +1331,10 @@ function initializeTextStream(underlyingSource, highWaterMark) { error: @handleDirectStreamError, end: @onCloseDirectStream, @close: @onCloseDirectStream, - drain: @onDrainDirectStream, + flush: @onFlushDirectStream, _pendingRead: @undefined, _deferClose: 0, - _deferDrain: 0, + _deferFlush: 0, _deferCloseReason: @undefined, _handleError: @undefined, }; @@ -1358,7 +1365,7 @@ function initializeArrayStream(underlyingSource, highWaterMark) { return chunk.byteLength || chunk.length; }, - drain() { + flush() { return 0; }, @@ -1386,10 +1393,10 @@ function initializeArrayStream(underlyingSource, highWaterMark) { error: @handleDirectStreamError, end: @onCloseDirectStream, @close: @onCloseDirectStream, - drain: @onDrainDirectStream, + flush: @onFlushDirectStream, _pendingRead: @undefined, _deferClose: 0, - _deferDrain: 0, + _deferFlush: 0, _deferCloseReason: @undefined, _handleError: @undefined, }; @@ -1424,10 +1431,10 @@ function initializeArrayBufferStream(underlyingSource, highWaterMark) { error: @handleDirectStreamError, end: @onCloseDirectStream, @close: @onCloseDirectStream, - drain: @onDrainDirectStream, + flush: @onFlushDirectStream, _pendingRead: @undefined, _deferClose: 0, - _deferDrain: 0, + _deferFlush: 0, _deferCloseReason: @undefined, _handleError: @undefined, }; @@ -1808,8 +1815,7 @@ function lazyLoadStream(stream, autoAllocateChunkSize) { var nativeType = @getByIdDirectPrivate(stream, "bunNativeType"); var nativePtr = @getByIdDirectPrivate(stream, "bunNativePtr"); - var cached = @lazyStreamPrototypeMap; - var Prototype = cached.@get(nativeType); + var Prototype = @lazyStreamPrototypeMap.@get(nativeType); if (Prototype === @undefined) { var [pull, start, cancel, setClose, deinit] = @lazyLoad(nativeType); var closer = [false]; @@ -1882,7 +1888,7 @@ function lazyLoadStream(stream, autoAllocateChunkSize) { static deinit = deinit; static registry = new FinalizationRegistry(deinit); }; - cached.@set(nativeType, Prototype); + @lazyStreamPrototypeMap.@set(nativeType, Prototype); } const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize); @@ -1974,7 +1980,7 @@ function readableStreamToArrayBufferDirect(stream, underlyingSource) { @fulfillPromise(capability.@promise, sink.end()); } }, - drain() { + flush() { return 0; }, write: sink.write.bind(sink), diff --git a/src/bun.js/generate-jssink.js b/src/bun.js/generate-jssink.js index 0323587dc..255bfe613 100644 --- a/src/bun.js/generate-jssink.js +++ b/src/bun.js/generate-jssink.js @@ -448,7 +448,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__doClose, (JSC::JSGlobalObject * lexicalGlobalO close ${`${name}__doClose`.padEnd( padding + 8 )} ReadOnly|DontDelete|Function 0 - drain ${`${name}__drain`.padEnd(padding + 8)} ReadOnly|DontDelete|Function 1 + flush ${`${name}__flush`.padEnd(padding + 8)} ReadOnly|DontDelete|Function 1 end ${`${name}__end`.padEnd(padding + 8)} ReadOnly|DontDelete|Function 0 start ${`${name}__start`.padEnd(padding + 8)} ReadOnly|DontDelete|Function 1 write ${`${name}__write`.padEnd(padding + 8)} ReadOnly|DontDelete|Function 1 @@ -462,7 +462,7 @@ JSC_DEFINE_HOST_FUNCTION(${name}__doClose, (JSC::JSGlobalObject * lexicalGlobalO close ${`${controller}__close`.padEnd( protopad + 4 )} ReadOnly|DontDelete|Function 0 - drain ${`${name}__drain`.padEnd( + flush ${`${name}__flush`.padEnd( protopad + 4 )} ReadOnly|DontDelete|Function 1 end ${`${controller}__end`.padEnd( diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index 90d29bf6f..9ed16caf0 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -1354,7 +1354,7 @@ pub const VirtualMachine = struct { // pub fn promiseRejectionTracker(global: *JSGlobalObject, promise: *JSPromise, _: JSPromiseRejectionOperation) callconv(.C) JSValue { // const result = promise.result(global.vm()); // if (@enumToInt(VirtualMachine.vm.last_error_jsvalue) != @enumToInt(result)) { - // VirtualMachine.vm.defaultErrorHandler(result, null); + // VirtualMachine.vm.runErrorHandler(result, null); // } // return JSValue.jsUndefined(); @@ -1502,7 +1502,7 @@ pub const VirtualMachine = struct { } } - pub fn defaultErrorHandler(this: *VirtualMachine, result: JSValue, exception_list: ?*ExceptionList) void { + pub fn runErrorHandler(this: *VirtualMachine, result: JSValue, exception_list: ?*ExceptionList) void { if (result.isException(this.global.vm())) { var exception = @ptrCast(*Exception, result.asVoid()); @@ -1758,7 +1758,7 @@ pub const VirtualMachine = struct { } pub fn reportUncaughtExceptio(_: *JSGlobalObject, exception: *JSC.Exception) JSValue { - VirtualMachine.vm.defaultErrorHandler(exception.value(), null); + VirtualMachine.vm.runErrorHandler(exception.value(), null); return JSC.JSValue.jsUndefined(); } diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 9c5ce2c8e..4a10b1062 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -46,6 +46,7 @@ const uws = @import("uws"); const Blob = JSC.WebCore.Blob; const Response = JSC.WebCore.Response; const Request = JSC.WebCore.Request; +const assert = std.debug.assert; pub const ReadableStream = struct { value: JSValue, @@ -882,21 +883,22 @@ pub const ArrayBufferSink = struct { return .{ .result = {} }; } - pub fn drain(_: *ArrayBufferSink) JSC.Node.Maybe(void) { + pub fn flush(_: *ArrayBufferSink) JSC.Node.Maybe(void) { return .{ .result = {} }; } - pub fn drainFromJS(this: *ArrayBufferSink, globalThis: *JSGlobalObject) JSC.Node.Maybe(JSValue) { + pub fn flushFromJS(this: *ArrayBufferSink, globalThis: *JSGlobalObject, wait: bool) JSC.Node.Maybe(JSValue) { if (this.streaming) { const value: JSValue = switch (this.as_uint8array) { true => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .Uint8Array), false => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .ArrayBuffer), }; this.bytes.len = 0; + if (wait) {} return .{ .result = value }; } - return .{ .result = JSValue.jsUndefined() }; + return .{ .result = JSValue.jsNumber(0) }; } pub fn finalize(this: *ArrayBufferSink) void { @@ -1108,6 +1110,7 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { var this = @ptrCast(*ThisSink, @alignCast(std.meta.alignment(ThisSink), ptr)); this.sink.finalize(); + this.detach(); } pub fn detach(this: *ThisSink) void { @@ -1244,7 +1247,7 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { return this.sink.end(null).toJS(globalThis); } - pub fn drain(globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { + pub fn flush(globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { JSC.markBinding(); var this = getThis(globalThis, callframe) orelse return invalidThis(globalThis); @@ -1262,11 +1265,14 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { } } - if (comptime @hasDecl(SinkType, "drainFromJS")) { - return this.sink.drainFromJS(globalThis).result; + if (comptime @hasDecl(SinkType, "flushFromJS")) { + const wait = callframe.argumentsCount() > 0 and + callframe.argument(0).isBoolean() and + callframe.argument(0).asBoolean(); + return this.sink.flushFromJS(globalThis, wait).result; } - return this.sink.drain().toJS(globalThis); + return this.sink.flush().toJS(globalThis); } pub fn start(globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { @@ -1346,7 +1352,7 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { .@"finalize" = finalize, .@"write" = write, .@"close" = close, - .@"drain" = drain, + .@"flush" = flush, .@"start" = start, .@"end" = end, .@"construct" = construct, @@ -1358,7 +1364,7 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { @export(finalize, .{ .name = Export[0].symbol_name }); @export(write, .{ .name = Export[1].symbol_name }); @export(close, .{ .name = Export[2].symbol_name }); - @export(drain, .{ .name = Export[3].symbol_name }); + @export(flush, .{ .name = Export[3].symbol_name }); @export(start, .{ .name = Export[4].symbol_name }); @export(end, .{ .name = Export[5].symbol_name }); @export(construct, .{ .name = Export[6].symbol_name }); @@ -1414,7 +1420,8 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { allocator: std.mem.Allocator, done: bool = false, signal: Signal = .{}, - pending_drain: ?*JSC.JSPromise = null, + pending_flush: ?*JSC.JSPromise = null, + wrote_at_start_of_flush: Blob.SizeType = 0, globalThis: *JSGlobalObject = undefined, highWaterMark: Blob.SizeType = 2048, @@ -1488,7 +1495,7 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { return true; } - // flush the javascript promise from calling .drain() + // flush the javascript promise from calling .flush() this.flushPromise(); if (this.has_callback) { @@ -1500,14 +1507,14 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { resume callback; } - // pending_drain or callback could have caused another send() + // pending_flush or callback could have caused another send() // so we check again if we should report readiness if (!this.done and !this.requested_end and !this.hasBackpressure()) { const pending = @truncate(Blob.SizeType, available) - to_write; - const written_after_drain = this.wrote - initial_wrote; - const to_report = pending - @minimum(written_after_drain, pending); + const written_after_flush = this.wrote - initial_wrote; + const to_report = pending - @minimum(written_after_flush, pending); - if ((written_after_drain == initial_wrote and pending == 0) or to_report > 0) { + if ((written_after_flush == initial_wrote and pending == 0) or to_report > 0) { this.signal.ready(to_report, null); } } @@ -1522,11 +1529,17 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { return .{ .result = {} }; } + this.wrote = 0; + this.wrote_at_start_of_flush = 0; + this.flushPromise(); + if (this.buffer.cap == 0) { std.debug.assert(this.pooled_buffer == null); - if (ByteListPool.has()) { - this.pooled_buffer = ByteListPool.get(this.allocator); - this.buffer = this.pooled_buffer.?.data; + if (comptime FeatureFlags.http_buffer_pooling) { + if (ByteListPool.has()) { + this.pooled_buffer = ByteListPool.get(this.allocator); + this.buffer = this.pooled_buffer.?.data; + } } } @@ -1547,6 +1560,7 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { this.buffer.update(list); this.done = false; + this.signal.start(); log("start({d})", .{this.highWaterMark}); @@ -1554,27 +1568,61 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { return .{ .result = {} }; } - pub fn drainFromJS(this: *@This(), globalThis: *JSGlobalObject) JSC.Node.Maybe(JSValue) { - log("drainFromJS()", .{}); + fn flushFromJSNoWait(this: *@This()) JSC.Node.Maybe(JSValue) { + if (this.hasBackpressure() or this.done) { + return .{ .result = JSValue.jsNumberFromInt32(0) }; + } - if (!this.hasBackpressure() or this.done) { + const slice = this.readableSlice(); + if (slice.len == 0) { return .{ .result = JSValue.jsNumberFromInt32(0) }; } - if (this.pending_drain) |prom| { + const success = this.send(slice); + if (success) { + this.handleWrote(@truncate(Blob.SizeType, slice.len)); + return .{ .result = JSValue.jsNumber(slice.len) }; + } + + return .{ .result = JSValue.jsNumberFromInt32(0) }; + } + + pub fn flushFromJS(this: *@This(), globalThis: *JSGlobalObject, wait: bool) JSC.Node.Maybe(JSValue) { + log("flushFromJS({s})", .{wait}); + if (!wait) { + return this.flushFromJSNoWait(); + } + + if (this.pending_flush) |prom| { return .{ .result = prom.asValue(globalThis) }; } - this.pending_drain = JSC.JSPromise.create(globalThis); + if (this.buffer.len == 0 or this.done) { + return .{ .result = JSC.JSPromise.resolvedPromiseValue(globalThis, JSValue.jsNumberFromInt32(0)) }; + } + + if (!this.hasBackpressure()) { + const slice = this.readableSlice(); + assert(slice.len > 0); + const success = this.send(slice); + if (success) { + this.handleWrote(@truncate(Blob.SizeType, slice.len)); + return .{ .result = JSC.JSPromise.resolvedPromiseValue(globalThis, JSValue.jsNumber(slice.len)) }; + } + + this.res.onWritable(*@This(), onWritable, this); + } + this.wrote_at_start_of_flush = this.wrote; + this.pending_flush = JSC.JSPromise.create(globalThis); this.globalThis = globalThis; - var promise_value = this.pending_drain.?.asValue(globalThis); + var promise_value = this.pending_flush.?.asValue(globalThis); promise_value.protect(); return .{ .result = promise_value }; } - pub fn drain(this: *@This()) JSC.Node.Maybe(void) { - log("drain()", .{}); + pub fn flush(this: *@This()) JSC.Node.Maybe(void) { + log("flush()", .{}); if (!this.hasBackpressure() or this.done) { return .{ .result = {} }; } @@ -1833,14 +1881,14 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { this.res.onWritable(*@This(), onWritable, this); } - if (this.pending_drain) |prom| { - this.pending_drain = null; + if (this.pending_flush) |prom| { + this.pending_flush = null; return .{ .result = prom.asValue(globalThis) }; } - this.pending_drain = JSC.JSPromise.create(globalThis); + this.pending_flush = JSC.JSPromise.create(globalThis); this.globalThis = globalThis; - const value = this.pending_drain.?.asValue(globalThis); + const value = this.pending_flush.?.asValue(globalThis); value.protect(); return .{ .result = value }; } @@ -1858,6 +1906,17 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { this.finalize(); } + pub fn destroy(this: *@This()) void { + log("destroy()", .{}); + var bytes = this.buffer.listManaged(this.allocator); + if (bytes.capacity > 0) { + this.buffer = bun.ByteList.init(""); + bytes.deinit(); + } + + this.allocator.destroy(this); + } + // This can be called _many_ times for the same instance // so it must zero out state instead of make it pub fn finalize(this: *@This()) void { @@ -1868,32 +1927,35 @@ pub fn HTTPServerWritable(comptime ssl: bool) type { this.res.endStream(false); } + if (comptime !FeatureFlags.http_buffer_pooling) { + assert(this.pooled_buffer == null); + } + if (this.pooled_buffer) |pooled| { this.buffer.len = 0; pooled.data = this.buffer; this.buffer = bun.ByteList.init(""); this.pooled_buffer = null; pooled.release(); - } else if (this.buffer.cap == 0) {} else if (!ByteListPool.full()) { + } else if (this.buffer.cap == 0) {} else if (FeatureFlags.http_buffer_pooling and !ByteListPool.full()) { var entry = ByteListPool.get(this.allocator); entry.data = this.buffer; this.buffer = bun.ByteList.init(""); entry.release(); } else { - var bytes = this.buffer.listManaged(this.allocator); - bytes.deinit(); this.buffer.len = 0; } } pub fn flushPromise(this: *@This()) void { - if (this.pending_drain) |prom| { + if (this.pending_flush) |prom| { log("flushPromise()", .{}); - this.pending_drain = null; + this.pending_flush = null; const globalThis = this.globalThis; prom.asValue(globalThis).unprotect(); - prom.resolve(globalThis, JSC.JSValue.jsNumber(0)); + prom.resolve(globalThis, JSC.JSValue.jsNumber(this.wrote -| this.wrote_at_start_of_flush)); + this.wrote_at_start_of_flush = this.wrote; } } diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig index 50be09878..92691fa05 100644 --- a/src/cli/test_command.zig +++ b/src/cli/test_command.zig @@ -362,7 +362,7 @@ pub const TestCommand = struct { } else { Output.prettyError("<r>", .{}); } - Output.prettyError(" {d:5>} expectations\n", .{reporter.summary.expectations}); + if (reporter.summary.expectations > 0) Output.prettyError(" {d:5>} expectations\n", .{reporter.summary.expectations}); Output.prettyError( \\ Ran {d} tests across {d} files @@ -450,7 +450,7 @@ pub const TestCommand = struct { switch (promise.status(vm.global.vm())) { .Rejected => { var result = promise.result(vm.global.vm()); - vm.defaultErrorHandler(result, null); + vm.runErrorHandler(result, null); return; }, else => {}, diff --git a/src/deps/uws.zig b/src/deps/uws.zig index fccc01837..c545de2df 100644 --- a/src/deps/uws.zig +++ b/src/deps/uws.zig @@ -1,3 +1,4 @@ +pub const is_bindgen = @import("std").meta.globalOption("bindgen", bool) orelse false; const Api = @import("../api/schema.zig").Api; const std = @import("std"); const Environment = @import("../env.zig"); @@ -511,15 +512,26 @@ pub fn NewApp(comptime ssl: bool) type { const ThisApp = @This(); pub fn create(opts: us_socket_context_options_t) *ThisApp { + if (comptime is_bindgen) { + unreachable; + } return @ptrCast(*ThisApp, uws_create_app(ssl_flag, opts)); } pub fn destroy(app: *ThisApp) void { + if (comptime is_bindgen) { + unreachable; + } + return uws_app_destroy(ssl_flag, @ptrCast(*uws_app_s, app)); } fn RouteHandler(comptime UserDataType: type, comptime handler: fn (UserDataType, *Request, *Response) void) type { return struct { pub fn handle(res: *uws_res, req: *Request, user_data: ?*anyopaque) callconv(.C) void { + if (comptime is_bindgen) { + unreachable; + } + if (comptime UserDataType == void) { return @call( .{ .modifier = .always_inline }, @@ -547,6 +559,9 @@ pub fn NewApp(comptime ssl: bool) type { pub const ListenSocket = opaque { pub inline fn close(this: *ListenSocket) void { + if (comptime is_bindgen) { + unreachable; + } return us_listen_socket_close(ssl_flag, @ptrCast(*listen_socket_t, this)); } }; @@ -558,6 +573,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_get(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn post( @@ -567,6 +585,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_post(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn options( @@ -576,6 +597,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_options(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn delete( @@ -585,6 +609,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_delete(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn patch( @@ -594,6 +621,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_patch(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn put( @@ -603,6 +633,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_put(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn head( @@ -612,6 +645,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_head(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn connect( @@ -621,6 +657,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_connect(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn trace( @@ -630,6 +669,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_trace(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn any( @@ -639,9 +681,15 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserDataType, comptime handler: (fn (UserDataType, *Request, *Response) void), ) void { + if (comptime is_bindgen) { + unreachable; + } uws_app_any(ssl_flag, @ptrCast(*uws_app_t, app), pattern, RouteHandler(UserDataType, handler).handle, user_data); } pub fn run(app: *ThisApp) void { + if (comptime is_bindgen) { + unreachable; + } return uws_app_run(ssl_flag, @ptrCast(*uws_app_t, app)); } pub fn listen( @@ -651,6 +699,9 @@ pub fn NewApp(comptime ssl: bool) type { user_data: UserData, comptime handler: fn (UserData, ?*ListenSocket, uws_app_listen_config_t) void, ) void { + if (comptime is_bindgen) { + unreachable; + } const Wrapper = struct { pub fn handle(socket: ?*listen_socket_t, conf: uws_app_listen_config_t, data: ?*anyopaque) callconv(.C) void { if (comptime UserData == void) { |