aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/bindings.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-03-19 14:08:20 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-19 14:08:20 -0700
commit5a23d176208bb38483b65b9420b18c8597fabfef (patch)
treef163dc03fdc75b7827ee7f51e17355a9cc82329f /src/bun.js/bindings/bindings.cpp
parent8f02ef829474cbd5453ffcb6485d40f93424ad26 (diff)
downloadbun-5a23d176208bb38483b65b9420b18c8597fabfef.tar.gz
bun-5a23d176208bb38483b65b9420b18c8597fabfef.tar.zst
bun-5a23d176208bb38483b65b9420b18c8597fabfef.zip
Several bug fixes (#2427)
* Fix test * Fix segfault when unexpected type is passed in `expect().toThrow` * Fix issues with request constructor * Don't bother cloning headers when its empty * woops * more tests * fix incorrect test * Make the fetch error messages better * Update response.zig * Fix test that failed on macOS * Fix test * Remove extra hash table lookups * Support running dummy registry directly cc @alexlamsl * Update test * Update test * fixup * Workaround crash in test runner * Fixup test * Fixup test * Update os.test.js --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/bindings.cpp')
-rw-r--r--src/bun.js/bindings/bindings.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 774c14d0c..a5af29128 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -700,6 +700,11 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2,
extern "C" {
+bool WebCore__FetchHeaders__isEmpty(WebCore__FetchHeaders* arg0)
+{
+ return arg0->size() == 0;
+}
+
void WebCore__FetchHeaders__toUWSResponse(WebCore__FetchHeaders* arg0, bool is_ssl, void* arg2)
{
if (is_ssl) {
@@ -3566,11 +3571,14 @@ enum class BuiltinNamesMap : uint8_t {
url,
body,
data,
+ toString,
+ redirect,
};
static JSC::Identifier builtinNameMap(JSC::JSGlobalObject* globalObject, unsigned char name)
{
- auto clientData = WebCore::clientData(globalObject->vm());
+ auto& vm = globalObject->vm();
+ auto clientData = WebCore::clientData(vm);
switch (static_cast<BuiltinNamesMap>(name)) {
case BuiltinNamesMap::method: {
return clientData->builtinNames().methodPublicName();
@@ -3590,7 +3598,24 @@ static JSC::Identifier builtinNameMap(JSC::JSGlobalObject* globalObject, unsigne
case BuiltinNamesMap::data: {
return clientData->builtinNames().dataPublicName();
}
+ case BuiltinNamesMap::toString: {
+ return vm.propertyNames->toString;
+ }
+ case BuiltinNamesMap::redirect: {
+ return clientData->builtinNames().redirectPublicName();
}
+ }
+}
+
+JSC__JSValue JSC__JSValue__fastGetDirect_(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, unsigned char arg2)
+{
+ JSC::JSValue value = JSC::JSValue::decode(JSValue0);
+ if (!value.isCell()) {
+ return JSValue::encode({});
+ }
+
+ return JSValue::encode(
+ value.getObject()->getDirect(globalObject->vm(), PropertyName(builtinNameMap(globalObject, arg2))));
}
JSC__JSValue JSC__JSValue__fastGet_(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, unsigned char arg2)