aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/bindings.cpp
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-03-17 17:14:39 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-17 17:14:39 -0700
commit1d4cc63154366dbdbdb87c8da43753cdac13d995 (patch)
tree55e1702c8f89b4f9c11d371a5e54bd80af2b2ac0 /src/bun.js/bindings/bindings.cpp
parentc5f2b4264993739440f73d166280c9ec74e27c1c (diff)
downloadbun-1d4cc63154366dbdbdb87c8da43753cdac13d995.tar.gz
bun-1d4cc63154366dbdbdb87c8da43753cdac13d995.tar.zst
bun-1d4cc63154366dbdbdb87c8da43753cdac13d995.zip
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
Diffstat (limited to 'src/bun.js/bindings/bindings.cpp')
-rw-r--r--src/bun.js/bindings/bindings.cpp22
1 files changed, 19 insertions, 3 deletions
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;
}