From 1794a02ad66a0aa228ab5eac110fd1809daf5545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Sat, 11 Sep 2021 17:37:53 -0300 Subject: [PATCH 1/4] FlowChunk: abort() behavior was inconsistent since the refactor in d64592c1 (2013) --- src/FlowChunk.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/FlowChunk.js b/src/FlowChunk.js index ece7f06..db74171 100644 --- a/src/FlowChunk.js +++ b/src/FlowChunk.js @@ -429,11 +429,10 @@ export default class FlowChunk { */ abort() { // Abort and reset - var xhr = this.xhr; - this.xhr = null; - if (xhr) { - xhr.abort(); + if (this.xhr) { + this.xhr.abort(); } + this.xhr = null; } /** From c5a17f8e20e51b5e756203d8f106218fd4a5c1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Sat, 11 Sep 2021 17:38:37 -0300 Subject: [PATCH 2/4] FlowChunk: Make superfluous chunks (in stream-mode) handle a subsequent call to abort() --- src/FlowChunk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FlowChunk.js b/src/FlowChunk.js index db74171..9c0fd65 100644 --- a/src/FlowChunk.js +++ b/src/FlowChunk.js @@ -346,7 +346,7 @@ export default class FlowChunk { // We make a fake request so that overall status is "complete" and we can move on // on this FlowFile. this.pendingRetry = false; - this.xhr = {readyState: 5, status: 1 }; + this.xhr = {readyState: 5, status: 200, abort: e => null }; this.doneHandler(null); return; } From 5293d0291866c262eda85f2d0b0a00d34c9c00fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Sun, 12 Sep 2021 23:32:58 -0300 Subject: [PATCH 3/4] removed useless comment --- src/FlowChunk.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FlowChunk.js b/src/FlowChunk.js index 9c0fd65..cd0edf5 100644 --- a/src/FlowChunk.js +++ b/src/FlowChunk.js @@ -428,7 +428,6 @@ export default class FlowChunk { * @function */ abort() { - // Abort and reset if (this.xhr) { this.xhr.abort(); } From f29b1cb6c8bfa169d7242ab7955718ba30cc7cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Sun, 12 Sep 2021 23:46:24 -0300 Subject: [PATCH 4/4] A correct readyState is 4 (equivalent to STATE_DONE) --- src/FlowChunk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FlowChunk.js b/src/FlowChunk.js index cd0edf5..82e2ffc 100644 --- a/src/FlowChunk.js +++ b/src/FlowChunk.js @@ -346,7 +346,7 @@ export default class FlowChunk { // We make a fake request so that overall status is "complete" and we can move on // on this FlowFile. this.pendingRetry = false; - this.xhr = {readyState: 5, status: 200, abort: e => null }; + this.xhr = {readyState: 4, status: 200, abort: e => null }; this.doneHandler(null); return; }