adress ci

This commit is contained in:
Meghan Denny
2025-07-23 03:09:15 -07:00
parent bab8261e16
commit 5b830c73a5
3 changed files with 21 additions and 72 deletions

View File

@@ -165,7 +165,7 @@ pub const JSPromise = opaque {
globalObject: *JSGlobalObject,
comptime Function: anytype,
args: std.meta.ArgsTuple(@TypeOf(Function)),
) JSValue {
) bun.JSExecutionTerminated!JSValue {
const Args = std.meta.ArgsTuple(@TypeOf(Function));
const Fn = Function;
const Wrapper = struct {
@@ -181,7 +181,7 @@ pub const JSPromise = opaque {
defer scope.deinit();
var ctx = Wrapper{ .args = args };
const promise = JSC__JSPromise__wrap(globalObject, &ctx, @ptrCast(&Wrapper.call));
scope.assertNoException();
if (scope.hasException()) return error.JSExecutionTerminated;
return promise;
}

View File

@@ -3324,7 +3324,7 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void
if (scope.exception()) [[unlikely]] {
auto* exception = scope.exception();
scope.clearException();
return JSValue::encode(JSC::JSPromise::rejectedPromise(globalObject, exception->value()));
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSPromise::rejectedPromise(globalObject, exception->value())));
}
scope.assertNoException();
@@ -3333,10 +3333,10 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void
}
if (JSC::ErrorInstance* err = jsDynamicCast<JSC::ErrorInstance*>(result)) {
return JSValue::encode(JSC::JSPromise::rejectedPromise(globalObject, err));
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSPromise::rejectedPromise(globalObject, err)));
}
return JSValue::encode(JSC::JSPromise::resolvedPromise(globalObject, result));
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSPromise::resolvedPromise(globalObject, result)));
}
[[ZIG_EXPORT(check_slow)]] void JSC__JSPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* globalObject,

View File

@@ -1824,10 +1824,7 @@ comptime {
_ = JSDOMFile__hasInstance;
}
pub fn constructBunFile(
globalObject: *jsc.JSGlobalObject,
callframe: *jsc.CallFrame,
) bun.JSError!jsc.JSValue {
pub fn constructBunFile(globalObject: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
var vm = globalObject.bunVM();
const arguments = callframe.arguments_old(2).slice();
var args = jsc.CallFrame.ArgumentsSlice.init(vm, arguments);
@@ -1947,11 +1944,7 @@ pub fn findOrCreateFileFromPath(path_or_fd: *jsc.Node.PathOrFileDescriptor, glob
return Blob.initWithStore(Blob.Store.initFile(path, null, allocator) catch bun.outOfMemory(), globalThis);
}
pub fn getStream(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
callframe: *jsc.CallFrame,
) bun.JSError!jsc.JSValue {
pub fn getStream(this: *Blob, globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
const thisValue = callframe.this();
if (js.streamGetCached(thisValue)) |cached| {
return cached;
@@ -1990,10 +1983,7 @@ pub fn getStream(
return stream;
}
pub fn toStreamWithOffset(
globalThis: *jsc.JSGlobalObject,
callframe: *jsc.CallFrame,
) bun.JSError!jsc.JSValue {
pub fn toStreamWithOffset(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
const this = callframe.this().as(Blob) orelse @panic("this is not a Blob");
const args = callframe.arguments_old(1).slice();
@@ -2013,55 +2003,35 @@ fn lifetimeWrap(comptime Fn: anytype, comptime lifetime: jsc.WebCore.Lifetime) f
}.wrap;
}
pub fn getText(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
_: *jsc.CallFrame,
) bun.JSError!jsc.JSValue {
pub fn getText(this: *Blob, globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue {
return this.getTextClone(globalThis);
}
pub fn getTextClone(
this: *Blob,
globalObject: *jsc.JSGlobalObject,
) jsc.JSValue {
pub fn getTextClone(this: *Blob, globalObject: *jsc.JSGlobalObject) bun.JSExecutionTerminated!jsc.JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalObject, lifetimeWrap(toString, .clone), .{ this, globalObject });
}
pub fn getTextTransfer(
this: *Blob,
globalObject: *jsc.JSGlobalObject,
) jsc.JSValue {
pub fn getTextTransfer(this: *Blob, globalObject: *jsc.JSGlobalObject) bun.JSExecutionTerminated!jsc.JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalObject, lifetimeWrap(toString, .transfer), .{ this, globalObject });
}
pub fn getJSON(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
_: *jsc.CallFrame,
) bun.JSError!jsc.JSValue {
pub fn getJSON(this: *Blob, globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue {
return this.getJSONShare(globalThis);
}
pub fn getJSONShare(
this: *Blob,
globalObject: *jsc.JSGlobalObject,
) jsc.JSValue {
pub fn getJSONShare(this: *Blob, globalObject: *jsc.JSGlobalObject) bun.JSExecutionTerminated!jsc.JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalObject, lifetimeWrap(toJSON, .share), .{ this, globalObject });
}
pub fn getArrayBufferTransfer(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
) jsc.JSValue {
pub fn getArrayBufferTransfer(this: *Blob, globalThis: *jsc.JSGlobalObject) bun.JSExecutionTerminated!jsc.JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
@@ -2069,57 +2039,36 @@ pub fn getArrayBufferTransfer(
return jsc.JSPromise.wrap(globalThis, lifetimeWrap(toArrayBuffer, .transfer), .{ this, globalThis });
}
pub fn getArrayBufferClone(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
) jsc.JSValue {
pub fn getArrayBufferClone(this: *Blob, globalThis: *jsc.JSGlobalObject) bun.JSExecutionTerminated!jsc.JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalThis, lifetimeWrap(toArrayBuffer, .clone), .{ this, globalThis });
}
pub fn getArrayBuffer(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
_: *jsc.CallFrame,
) bun.JSError!JSValue {
pub fn getArrayBuffer(this: *Blob, globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue {
return this.getArrayBufferClone(globalThis);
}
pub fn getBytesClone(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
) JSValue {
pub fn getBytesClone(this: *Blob, globalThis: *jsc.JSGlobalObject) bun.JSExecutionTerminated!JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalThis, lifetimeWrap(toUint8Array, .clone), .{ this, globalThis });
}
pub fn getBytes(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
_: *jsc.CallFrame,
) bun.JSError!JSValue {
pub fn getBytes(this: *Blob, globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue {
return this.getBytesClone(globalThis);
}
pub fn getBytesTransfer(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
) JSValue {
pub fn getBytesTransfer(this: *Blob, globalThis: *jsc.JSGlobalObject) JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
return jsc.JSPromise.wrap(globalThis, lifetimeWrap(toUint8Array, .transfer), .{ this, globalThis });
}
pub fn getFormData(
this: *Blob,
globalThis: *jsc.JSGlobalObject,
_: *jsc.CallFrame,
) bun.JSError!JSValue {
pub fn getFormData(this: *Blob, globalThis: *jsc.JSGlobalObject, _: *jsc.CallFrame) bun.JSError!JSValue {
const store = this.store;
if (store) |st| st.ref();
defer if (store) |st| st.deref();
@@ -4104,7 +4053,7 @@ pub const Any = union(enum) {
}
}
pub fn toPromise(this: *Any, globalThis: *JSGlobalObject, action: streams.BufferAction.Tag) jsc.JSValue {
pub fn toPromise(this: *Any, globalThis: *JSGlobalObject, action: streams.BufferAction.Tag) bun.JSExecutionTerminated!jsc.JSValue {
return jsc.JSPromise.wrap(globalThis, toActionValue, .{ this, globalThis, action });
}