Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/FlowChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: 4, status: 200, abort: e => null };
this.doneHandler(null);
return;
}
Expand Down Expand Up @@ -428,12 +428,10 @@ export default class FlowChunk {
* @function
*/
abort() {
// Abort and reset
var xhr = this.xhr;
this.xhr = null;
if (xhr) {
xhr.abort();
if (this.xhr) {
this.xhr.abort();
}
this.xhr = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember this was made on purpose to prevent some kind of loop happening. I think abort throws some kind of synchronous event and that event calls abort there abort is called once again and it throws an error that it was already aborted or something.

Copy link
Collaborator Author

@drzraf drzraf Sep 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could happen if something registered the abort event of the XHR itself:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort_event
But none of the code does this AFAICT. I'd say it's up to the consumer to attach "safe" event handler to XHR abort.
Don't you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it solves your problem and we don't have any other explanation, let's leave it in a way it works best for you

}

/**
Expand Down