|
1 | 1 | /* |
2 | | - * jQuery File Upload Plugin 5.19.2 |
| 2 | + * jQuery File Upload Plugin 5.19.3 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload |
4 | 4 | * |
5 | 5 | * Copyright 2010, Sebastian Tschan |
|
644 | 644 | _onSend: function (e, data) { |
645 | 645 | var that = this, |
646 | 646 | jqXHR, |
| 647 | + aborted, |
647 | 648 | slot, |
648 | 649 | pipe, |
649 | 650 | options = that._getAJAXSettings(data), |
650 | | - send = function (resolve, args) { |
| 651 | + send = function () { |
651 | 652 | that._sending += 1; |
652 | 653 | // Set timer for bitrate progress calculation: |
653 | 654 | options._bitrateTimer = new that._BitrateTimer(); |
654 | 655 | jqXHR = jqXHR || ( |
655 | | - (resolve !== false && |
656 | | - that._trigger('send', e, options) !== false && |
657 | | - (that._chunkedUpload(options) || $.ajax(options))) || |
658 | | - that._getXHRPromise(false, options.context, args) |
| 656 | + ((aborted || that._trigger('send', e, options) === false) && |
| 657 | + that._getXHRPromise(false, options.context, aborted)) || |
| 658 | + that._chunkedUpload(options) || $.ajax(options) |
659 | 659 | ).done(function (result, textStatus, jqXHR) { |
660 | 660 | that._onDone(result, textStatus, jqXHR, options); |
661 | 661 | }).fail(function (jqXHR, textStatus, errorThrown) { |
|
705 | 705 | // which is delegated to the jqXHR object of the current upload, |
706 | 706 | // and jqXHR callbacks mapped to the equivalent Promise methods: |
707 | 707 | pipe.abort = function () { |
708 | | - var args = [undefined, 'abort', 'abort']; |
| 708 | + aborted = [undefined, 'abort', 'abort']; |
709 | 709 | if (!jqXHR) { |
710 | 710 | if (slot) { |
711 | | - slot.rejectWith(pipe, args); |
| 711 | + slot.rejectWith(options.context, aborted); |
712 | 712 | } |
713 | | - return send(false, args); |
| 713 | + return send(); |
714 | 714 | } |
715 | 715 | return jqXHR.abort(); |
716 | 716 | }; |
|
0 commit comments