diff --git a/src/bun.js/bindings/webcore/AbortSignal.cpp b/src/bun.js/bindings/webcore/AbortSignal.cpp index 7d22ef7a9b..8886fb57a0 100644 --- a/src/bun.js/bindings/webcore/AbortSignal.cpp +++ b/src/bun.js/bindings/webcore/AbortSignal.cpp @@ -195,6 +195,7 @@ void AbortSignal::cleanNativeBindings(void* ref) }); std::exchange(m_native_callbacks, WTFMove(callbacks)); + this->eventListenersDidChange(); } // https://dom.spec.whatwg.org/#abortsignal-follow @@ -218,7 +219,7 @@ void AbortSignal::signalFollow(AbortSignal& signal) void AbortSignal::eventListenersDidChange() { - m_hasAbortEventListener = hasEventListeners(eventNames().abortEvent); + m_hasAbortEventListener = hasEventListeners(eventNames().abortEvent) or !m_native_callbacks.isEmpty(); } uint32_t AbortSignal::addAbortAlgorithmToSignal(AbortSignal& signal, Ref&& algorithm)