mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-09 05:19:32 +08:00
fix: validate AbortSignal instances before calling AbortSignal.any()
Fixes #7269
This commit is contained in:
@@ -22,9 +22,14 @@ function combineAbortSignals(a?: AbortSignal, b?: AbortSignal): AbortSignal | un
|
||||
if (b?.aborted) {
|
||||
return b;
|
||||
}
|
||||
if (typeof AbortSignal.any === "function") {
|
||||
return AbortSignal.any([a as AbortSignal, b as AbortSignal]);
|
||||
if (
|
||||
typeof AbortSignal.any === "function" &&
|
||||
a instanceof AbortSignal &&
|
||||
b instanceof AbortSignal
|
||||
) {
|
||||
return AbortSignal.any([a, b]);
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const onAbort = () => controller.abort();
|
||||
a?.addEventListener("abort", onAbort, { once: true });
|
||||
|
||||
Reference in New Issue
Block a user