From 597053ea91a83ed0ce98bf1b8bb59fbf282c3619 Mon Sep 17 00:00:00 2001 From: Ciro Spaciari Date: Wed, 15 Feb 2023 19:20:40 -0300 Subject: feat(fetch) AbortSignal (#2019) * add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior --- src/bun.js/bindings/headers.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/bun.js/bindings/headers.h') diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 159a7acbd..59450ecf1 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -1,5 +1,5 @@ // clang-format off -//-- AUTOGENERATED FILE -- 1676266700 +//-- AUTOGENERATED FILE -- 1676470760 #pragma once #include @@ -55,6 +55,7 @@ typedef void* JSClassRef; typedef bJSC__JSObject JSC__JSObject; // JSC::JSObject typedef WebSocketClient WebSocketClient; typedef WebSocketHTTPSClient WebSocketHTTPSClient; + typedef struct JSC__AbortSignal JSC__AbortSignal; // JSC::AbortSignal typedef JSClassRef JSClassRef; typedef bJSC__VM JSC__VM; // JSC::VM typedef Bun__ArrayBuffer Bun__ArrayBuffer; @@ -85,6 +86,7 @@ typedef void* JSClassRef; class JSGlobalObject; class JSPromise; class Exception; + class AbortSignal; class JSString; class JSInternalPromise; class CatchScope; @@ -116,6 +118,7 @@ typedef void* JSClassRef; using JSC__JSGlobalObject = JSC::JSGlobalObject; using JSC__JSPromise = JSC::JSPromise; using JSC__Exception = JSC::Exception; + using JSC__AbortSignal = JSC::AbortSignal; using JSC__JSString = JSC::JSString; using JSC__JSInternalPromise = JSC::JSInternalPromise; using JSC__CatchScope = JSC::CatchScope; @@ -202,6 +205,18 @@ CPP_DECL void JSC__JSString__toZigString(JSC__JSString* arg0, JSC__JSGlobalObjec CPP_DECL JSC__JSValue JSC__JSModuleLoader__evaluate(JSC__JSGlobalObject* arg0, const unsigned char* arg1, size_t arg2, const unsigned char* arg3, size_t arg4, const unsigned char* arg5, size_t arg6, JSC__JSValue JSValue7, JSC__JSValue* arg8); CPP_DECL JSC__JSInternalPromise* JSC__JSModuleLoader__loadAndEvaluateModule(JSC__JSGlobalObject* arg0, const ZigString* arg1); +#pragma mark - JSC::AbortSignal + +CPP_DECL bool JSC__AbortSignal__aborted(JSC__AbortSignal* arg0); +CPP_DECL JSC__JSValue JSC__AbortSignal__abortReason(JSC__AbortSignal* arg0); +CPP_DECL JSC__AbortSignal* JSC__AbortSignal__addListener(JSC__AbortSignal* arg0, void* arg1, void(* ArgFn2)(void* arg0, JSC__JSValue JSValue1)) __attribute__((nonnull (2))); +CPP_DECL JSC__JSValue JSC__AbortSignal__createAbortError(const ZigString* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); +CPP_DECL JSC__JSValue JSC__AbortSignal__createTimeoutError(const ZigString* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); +CPP_DECL JSC__AbortSignal* JSC__AbortSignal__fromJS(JSC__JSValue JSValue0); +CPP_DECL JSC__AbortSignal* JSC__AbortSignal__ref(JSC__AbortSignal* arg0); +CPP_DECL JSC__AbortSignal* JSC__AbortSignal__signal(JSC__AbortSignal* arg0, JSC__JSValue JSValue1); +CPP_DECL JSC__AbortSignal* JSC__AbortSignal__unref(JSC__AbortSignal* arg0); + #pragma mark - JSC::JSPromise CPP_DECL JSC__JSValue JSC__JSPromise__asValue(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1); -- cgit v1.2.3