mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 03:01:50 +03: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) {
|
if (b?.aborted) {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
if (typeof AbortSignal.any === "function") {
|
if (
|
||||||
return AbortSignal.any([a as AbortSignal, b as AbortSignal]);
|
typeof AbortSignal.any === "function" &&
|
||||||
|
a instanceof AbortSignal &&
|
||||||
|
b instanceof AbortSignal
|
||||||
|
) {
|
||||||
|
return AbortSignal.any([a, b]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const onAbort = () => controller.abort();
|
const onAbort = () => controller.abort();
|
||||||
a?.addEventListener("abort", onAbort, { once: true });
|
a?.addEventListener("abort", onAbort, { once: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user