@@ -50748,16 +50748,29 @@ static JSValue js_promise_withResolvers(JSContext *ctx, JSValueConst this_val,
5074850748 if (JS_IsException(result_promise))
5074950749 return JS_EXCEPTION;
5075050750 obj = JS_NewObject(ctx);
50751- if (JS_IsException(obj)) {
50752- JS_FreeValue(ctx, resolving_funcs[0]);
50753- JS_FreeValue(ctx, resolving_funcs[1]);
50754- JS_FreeValue(ctx, result_promise);
50755- return JS_EXCEPTION;
50751+ if (JS_IsException(obj))
50752+ goto exception;
50753+ if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_promise, result_promise,
50754+ JS_PROP_C_W_E) < 0) {
50755+ goto exception;
50756+ }
50757+ result_promise = JS_UNDEFINED;
50758+ if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_resolve, resolving_funcs[0],
50759+ JS_PROP_C_W_E) < 0) {
50760+ goto exception;
50761+ }
50762+ resolving_funcs[0] = JS_UNDEFINED;
50763+ if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_reject, resolving_funcs[1],
50764+ JS_PROP_C_W_E) < 0) {
50765+ goto exception;
5075650766 }
50757- JS_DefinePropertyValue(ctx, obj, JS_ATOM_promise, result_promise, JS_PROP_C_W_E);
50758- JS_DefinePropertyValue(ctx, obj, JS_ATOM_resolve, resolving_funcs[0], JS_PROP_C_W_E);
50759- JS_DefinePropertyValue(ctx, obj, JS_ATOM_reject, resolving_funcs[1], JS_PROP_C_W_E);
5076050767 return obj;
50768+ exception:
50769+ JS_FreeValue(ctx, resolving_funcs[0]);
50770+ JS_FreeValue(ctx, resolving_funcs[1]);
50771+ JS_FreeValue(ctx, result_promise);
50772+ JS_FreeValue(ctx, obj);
50773+ return JS_EXCEPTION;
5076150774}
5076250775
5076350776static JSValue js_promise_try(JSContext *ctx, JSValueConst this_val,
0 commit comments