Remove progress events.

This commit is contained in:
Brendan Dahl 2013-06-06 15:48:54 -07:00
parent ae1f973204
commit 7764dd95c0

View File

@ -653,7 +653,6 @@ function isPDFFunction(v) {
* Promise/A+ spec. Some notable differences from other promise libaries are: * Promise/A+ spec. Some notable differences from other promise libaries are:
* - There currently isn't a seperate deferred and promise object. * - There currently isn't a seperate deferred and promise object.
* - Unhandled rejections eventually show an error if they aren't handled. * - Unhandled rejections eventually show an error if they aren't handled.
* - Progress events are supported.
* *
* Based off of the work in: * Based off of the work in:
* https://bugzilla.mozilla.org/show_bug.cgi?id=810490 * https://bugzilla.mozilla.org/show_bug.cgi?id=810490
@ -662,7 +661,6 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
var STATUS_PENDING = 0; var STATUS_PENDING = 0;
var STATUS_RESOLVED = 1; var STATUS_RESOLVED = 1;
var STATUS_REJECTED = 2; var STATUS_REJECTED = 2;
var STATUS_PROGRESS = 3;
// In an attempt to avoid silent exceptions, unhandled rejections are // In an attempt to avoid silent exceptions, unhandled rejections are
// tracked and if they aren't handled in a certain amount of time an // tracked and if they aren't handled in a certain amount of time an
@ -681,9 +679,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
} }
this.handlers = this.handlers.concat(promise._handlers); this.handlers = this.handlers.concat(promise._handlers);
if (promise._status !== STATUS_PROGRESS) { promise._handlers = [];
promise._handlers = [];
}
if (this.running) { if (this.running) {
return; return;
@ -705,10 +701,6 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
if (typeof(handler.onResolve) == 'function') { if (typeof(handler.onResolve) == 'function') {
nextValue = handler.onResolve(nextValue); nextValue = handler.onResolve(nextValue);
} }
} else if (nextStatus === STATUS_PROGRESS) {
if (typeof(handler.onProgress) === 'function') {
nextValue = handler.onProgress(nextValue);
}
} else if (typeof(handler.onReject) === 'function') { } else if (typeof(handler.onReject) === 'function') {
nextValue = handler.onReject(nextValue); nextValue = handler.onReject(nextValue);
nextStatus = STATUS_RESOLVED; nextStatus = STATUS_RESOLVED;
@ -857,17 +849,12 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
this._updateStatus(STATUS_REJECTED, reason); this._updateStatus(STATUS_REJECTED, reason);
}, },
notify: function Promise_notify(update) { then: function Promise_then(onResolve, onReject) {
this._updateStatus(STATUS_PROGRESS, update);
},
then: function Promise_then(onResolve, onReject, onProgress) {
var nextPromise = new Promise(); var nextPromise = new Promise();
this._handlers.push({ this._handlers.push({
thisPromise: this, thisPromise: this,
onResolve: onResolve, onResolve: onResolve,
onReject: onReject, onReject: onReject,
onProgress: onProgress,
nextPromise: nextPromise nextPromise: nextPromise
}); });
HandlerManager.scheduleHandlers(this); HandlerManager.scheduleHandlers(this);