summaryrefslogtreecommitdiff
path: root/ext/fetch/23_request.js
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /ext/fetch/23_request.js
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'ext/fetch/23_request.js')
-rw-r--r--ext/fetch/23_request.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index 6211e927d..61cac22d2 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -269,19 +269,25 @@ class Request {
/** @type {AbortSignal} */
get [_signal]() {
const signal = this[_signalCache];
- // This signal not been created yet, and the request is still in progress
- if (signal === undefined) {
+ // This signal has not been created yet, but the request has already completed
+ if (signal === false) {
const signal = newSignal();
this[_signalCache] = signal;
+ signal[signalAbort](signalAbortError);
return signal;
}
- // This signal has not been created yet, but the request has already completed
- if (signal === false) {
+
+ // This signal not been created yet, and the request is still in progress
+ if (signal === undefined) {
const signal = newSignal();
this[_signalCache] = signal;
- signal[signalAbort](signalAbortError);
+ this[_request].onCancel?.(() => {
+ signal[signalAbort](signalAbortError);
+ });
+
return signal;
}
+
return signal;
}
get [_mimeType]() {