diff --git a/src/jio/core/Promise.js b/src/jio/core/Promise.js index a3c7b22f916f6bce15af77207e80ee4ec6bab285..2d9024306f5340c30df07446643b105611f34cab 100644 --- a/src/jio/core/Promise.js +++ b/src/jio/core/Promise.js @@ -519,7 +519,23 @@ Promise.prototype.then = function (onSuccess, onError, onProgress) { }); } if (typeof onProgress === 'function') { - this._onProgress.push(onProgress); + this._onProgress.push(function () { + var result; + try { + result = onProgress.apply(that, arguments); + if (result === undefined) { + resolver.notify.apply(that, arguments); + } else { + resolver.notify(result); + } + } catch (e) { + resolver.notify.apply(that, arguments); + } + }); + } else { + this._onProgress.push(function () { + resolver.notify.apply(resolver, arguments); + }); } break; }