|
1 | 1 | /* |
2 | | - * jQuery File Upload Plugin 5.28.1 |
| 2 | + * jQuery File Upload Plugin 5.28.2 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload |
4 | 4 | * |
5 | 5 | * Copyright 2010, Sebastian Tschan |
|
734 | 734 |
|
735 | 735 | _onFail: function (jqXHR, textStatus, errorThrown, options) { |
736 | 736 | var response = options._response; |
737 | | - response.jqXHR = options.jqXHR = jqXHR; |
738 | | - response.textStatus = options.textStatus = textStatus; |
739 | | - response.errorThrown = options.errorThrown = errorThrown; |
740 | | - this._trigger('fail', null, options); |
741 | 737 | if (options.recalculateProgress) { |
742 | 738 | // Remove the failed (error or abort) file upload from |
743 | 739 | // the global progress calculation: |
744 | 740 | this._progress.loaded -= options._progress.loaded; |
745 | 741 | this._progress.total -= options._progress.total; |
746 | 742 | } |
| 743 | + response.jqXHR = options.jqXHR = jqXHR; |
| 744 | + response.textStatus = options.textStatus = textStatus; |
| 745 | + response.errorThrown = options.errorThrown = errorThrown; |
| 746 | + this._trigger('fail', null, options); |
747 | 747 | }, |
748 | 748 |
|
749 | 749 | _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { |
750 | 750 | // jqXHRorResult, textStatus and jqXHRorError are added to the |
751 | 751 | // options object via done and fail callbacks |
752 | | - this._active -= 1; |
753 | 752 | this._trigger('always', null, options); |
754 | | - if (this._active === 0) { |
755 | | - // The stop callback is triggered when all uploads have |
756 | | - // been completed, equivalent to the global ajaxStop event: |
757 | | - this._trigger('stop'); |
758 | | - } |
759 | 753 | }, |
760 | 754 |
|
761 | 755 | _onSend: function (e, data) { |
|
781 | 775 | }).fail(function (jqXHR, textStatus, errorThrown) { |
782 | 776 | that._onFail(jqXHR, textStatus, errorThrown, options); |
783 | 777 | }).always(function (jqXHRorResult, textStatus, jqXHRorError) { |
784 | | - that._sending -= 1; |
785 | 778 | that._onAlways( |
786 | 779 | jqXHRorResult, |
787 | 780 | textStatus, |
788 | 781 | jqXHRorError, |
789 | 782 | options |
790 | 783 | ); |
| 784 | + that._sending -= 1; |
| 785 | + that._active -= 1; |
791 | 786 | if (options.limitConcurrentUploads && |
792 | 787 | options.limitConcurrentUploads > that._sending) { |
793 | 788 | // Start the next queued upload, |
|
801 | 796 | nextSlot = that._slots.shift(); |
802 | 797 | } |
803 | 798 | } |
| 799 | + if (that._active === 0) { |
| 800 | + // The stop callback is triggered when all uploads have |
| 801 | + // been completed, equivalent to the global ajaxStop event: |
| 802 | + that._trigger('stop'); |
| 803 | + } |
804 | 804 | }); |
805 | 805 | return jqXHR; |
806 | 806 | }; |
|
0 commit comments