From 1d4cc63154366dbdbdb87c8da43753cdac13d995 Mon Sep 17 00:00:00 2001 From: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:14:39 -0700 Subject: Fix various fetch/response/request tests (#2416) * fix most fetch tests, skip a few * fastGet, toValueGC, and invalid init * bigint unreachable, range error, log process as process * remove extra fetch_headers * remove js_type parameter, check isObject() * throw invalid mime type error, use enum literal * switch back to promise rejection * RangeError pascal case --- src/bun.js/bindings/bindings.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/bun.js/bindings/bindings.cpp') diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 3b0137c28..774c14d0c 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -2031,6 +2031,21 @@ JSC__JSValue ZigString__toErrorInstance(const ZigString* str, JSC__JSGlobalObjec return JSC::JSValue::encode(Zig::getErrorInstance(str, globalObject)); } +JSC__JSValue ZigString__toTypeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + return JSC::JSValue::encode(Zig::getTypeErrorInstance(str, globalObject)); +} + +JSC__JSValue ZigString__toSyntaxErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + return JSC::JSValue::encode(Zig::getSyntaxErrorInstance(str, globalObject)); +} + +JSC__JSValue ZigString__toRangeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + return JSC::JSValue::encode(Zig::getRangeErrorInstance(str, globalObject)); +} + static JSC::EncodedJSValue resolverFunctionCallback(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) { @@ -2845,7 +2860,8 @@ JSC__JSString* JSC__JSValue__toStringOrNull(JSC__JSValue JSValue0, JSC__JSGlobal return value.toStringOrNull(arg1); } -bool JSC__JSValue__toMatch(JSC__JSValue regexValue, JSC__JSGlobalObject* global, JSC__JSValue value) { +bool JSC__JSValue__toMatch(JSC__JSValue regexValue, JSC__JSGlobalObject* global, JSC__JSValue value) +{ JSC::JSValue regex = JSC::JSValue::decode(regexValue); JSC::JSValue str = JSC::JSValue::decode(value); if (regex.asCell()->type() != RegExpObjectType || !str.isString()) { @@ -3831,8 +3847,8 @@ bool JSC__JSValue__isInstanceOf(JSC__JSValue JSValue0, JSC__JSGlobalObject* glob if (UNLIKELY(!jsConstructor->structure()->typeInfo().implementsHasInstance())) return false; bool result = jsConstructor->hasInstance(globalObject, jsValue); - - RETURN_IF_EXCEPTION(scope, false); + + RETURN_IF_EXCEPTION(scope, false); return result; } -- cgit v1.2.3