aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-08-29 14:20:01 -0700
committerGravatar dave caruso <me@paperdave.net> 2023-09-13 17:25:59 -0700
commitf2ef69d680a2f0b672c9eaff3c78fe19f2d4a33d (patch)
tree51aa836778fc0698d1f0de1bfb1d4fdf517598d1 /src/bun.js
parent4f8edb825f48d06891de7a77131c6a434c06df88 (diff)
downloadbun-f2ef69d680a2f0b672c9eaff3c78fe19f2d4a33d.tar.gz
bun-f2ef69d680a2f0b672c9eaff3c78fe19f2d4a33d.tar.zst
bun-f2ef69d680a2f0b672c9eaff3c78fe19f2d4a33d.zip
feat(compat): support `got`
Diffstat (limited to 'src/bun.js')
-rw-r--r--src/bun.js/bindings/webcore/JSEventEmitter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/bun.js/bindings/webcore/JSEventEmitter.cpp
index 959cbd8d7..abf610803 100644
--- a/src/bun.js/bindings/webcore/JSEventEmitter.cpp
+++ b/src/bun.js/bindings/webcore/JSEventEmitter.cpp
@@ -233,8 +233,6 @@ inline JSC::EncodedJSValue JSEventEmitter::addListener(JSC::JSGlobalObject* lexi
EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1);
auto listener = convert<IDLNullable<IDLEventListener<JSEventListener>>>(*lexicalGlobalObject, argument1.value(), *castedThis, [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeObjectError(lexicalGlobalObject, scope, 1, "listener", "EventEmitter", "addListener"); });
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto result = JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTFMove(eventType), WTFMove(listener), once, prepend); }));
- RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSC::Identifier newListenerEventType = JSC::Identifier::fromString(vm, "newListener"_s);
JSC::MarkedArgumentBuffer args;
@@ -244,6 +242,9 @@ inline JSC::EncodedJSValue JSEventEmitter::addListener(JSC::JSGlobalObject* lexi
auto result2 = JSValue::encode(toJS<IDLBoolean>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.emitForBindings(WTFMove(newListenerEventType), WTFMove(args)); }));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ auto result = JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTFMove(eventType), WTFMove(listener), once, prepend); }));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+
vm.writeBarrier(&static_cast<JSObject&>(*castedThis), argument1.value());
impl.setThisObject(actualThis);
RELEASE_AND_RETURN(throwScope, JSValue::encode(actualThis));