Ran into some weird behavior with AbortController in Safari 17.
Pretty basic fetch with a timeout:
const controller = new AbortController();
setTimeout(() => controller.abort(), 3000);
try {
const res = await fetch(url, {
signal: controller.signal
});
} catch (e) {
console.log(e.name);
}
In Chrome and Firefox I consistently get AbortError, but in Safari the request sometimes just keeps hanging, especially when the server keeps the connection alive for a while.
Anyone else seen this?
Is this a Safari bug or am I missing something with signals/cleanup?
Mainly interested in behavior on macOS Sonoma + Safari 17.x.