zig: prefer .jsUndefined() over .undefined for JSValue (#20332)

This commit is contained in:
Meghan Denny
2025-06-12 12:18:46 -08:00
committed by GitHub
parent d6590c4bfa
commit dedd433cbf
84 changed files with 569 additions and 574 deletions

View File

@@ -120,7 +120,7 @@ fn Bun__revokeObjectURL_(globalObject: *JSC.JSGlobalObject, callframe: *JSC.Call
}
const str = arguments.ptr[0].toBunString(globalObject) catch @panic("unreachable");
if (!str.hasPrefixComptime("blob:")) {
return JSC.JSValue.undefined;
return .jsUndefined();
}
const slice = str.toUTF8WithoutRef(bun.default_allocator);
@@ -129,10 +129,10 @@ fn Bun__revokeObjectURL_(globalObject: *JSC.JSGlobalObject, callframe: *JSC.Call
const sliced = slice.slice();
if (sliced.len < "blob:".len + UUID.stringLength) {
return JSC.JSValue.undefined;
return .jsUndefined();
}
ObjectURLRegistry.singleton().revoke(sliced["blob:".len..]);
return JSC.JSValue.undefined;
return .jsUndefined();
}
comptime {
@@ -146,7 +146,7 @@ fn jsFunctionResolveObjectURL_(globalObject: *JSC.JSGlobalObject, callframe: *JS
// Not thrown.
// https://github.com/nodejs/node/blob/2eff28fb7a93d3f672f80b582f664a7c701569fb/lib/internal/blob.js#L441
if (arguments.len < 1) {
return JSC.JSValue.undefined;
return .jsUndefined();
}
const str = try arguments.ptr[0].toBunString(globalObject);
defer str.deref();
@@ -156,7 +156,7 @@ fn jsFunctionResolveObjectURL_(globalObject: *JSC.JSGlobalObject, callframe: *JS
}
if (!str.hasPrefixComptime("blob:") or str.length() < specifier_len) {
return JSC.JSValue.undefined;
return .jsUndefined();
}
const slice = str.toUTF8WithoutRef(bun.default_allocator);
@@ -165,7 +165,7 @@ fn jsFunctionResolveObjectURL_(globalObject: *JSC.JSGlobalObject, callframe: *JS
const registry = ObjectURLRegistry.singleton();
const blob = registry.resolveAndDupeToJS(sliced["blob:".len..], globalObject);
return blob orelse JSC.JSValue.undefined;
return blob orelse .jsUndefined();
}
pub const specifier_len = "blob:".len + UUID.stringLength;