commit e00909b3392b2523d58fd5319106a6489e72721c parent aab592f583476ed40ad77f52a7c7a34c762d5d0b Author: Sergej Orlov <wladimirych@gmail.com> Date: Thu, 9 Feb 2017 11:32:47 +0300 Fixed xhr-queue -- do not decrement active requests counter when aborting completed request Diffstat:
M | src/lib/xhr-promise/index.js | | | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/lib/xhr-promise/index.js b/src/lib/xhr-promise/index.js @@ -114,11 +114,17 @@ class XHRQueue { _abortPromise(promise) { const i = this._queue.indexOf(promise); if (i > -1) { + // console.log('ABORT IN QUEUE'); this._queue.splice(i, 1); } else { - promise._originalAbort(); - this._activeCount -= 1; - setTimeout(() => this._processQueue(), 0); + if (promise.xhr.readyState === 4) { + // console.log('ABORT COMPLETED'); + } else { + // console.log('ABORT ACTIVE'); + promise._originalAbort(); + this._activeCount -= 1; + setTimeout(() => this._processQueue(), 0); + } } }