Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Commit

Permalink
Explicit deinitialization of progress listeners.
Browse files Browse the repository at this point in the history
This addresses a memory leak with Microsoft Edge.
Thanks @butonic for the report, investigation and fix.
Closes #3508
  • Loading branch information
blueimp committed Oct 14, 2018
1 parent e368706 commit 3dd18f9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/jquery.fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@
}
},

_deinitProgressListener: function (options) {
var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
if (xhr.upload) {
$(xhr.upload).unbind('progress');
}
},

_isInstanceOf: function (type, obj) {
// Cross-frame instanceof check
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
Expand Down Expand Up @@ -812,6 +819,9 @@
o.context,
[jqXHR, textStatus, errorThrown]
);
})
.always(function () {
that._deinitProgressListener(o);
});
};
this._enhancePromise(promise);
Expand Down Expand Up @@ -913,6 +923,7 @@
}).fail(function (jqXHR, textStatus, errorThrown) {
that._onFail(jqXHR, textStatus, errorThrown, options);
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
that._deinitProgressListener(options);
that._onAlways(
jqXHRorResult,
textStatus,
Expand Down

0 comments on commit 3dd18f9

Please sign in to comment.