Fix bug w/ exception not being passed to error callbacks of a Promise
This commit is contained in:
parent
e61b104852
commit
4f1e94c9f7
@ -503,6 +503,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.isRejected = false;
|
this.isRejected = false;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
this.exception = null;
|
||||||
// If you build a promise and pass in some data it's already resolved.
|
// If you build a promise and pass in some data it's already resolved.
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.isResolved = true;
|
this.isResolved = true;
|
||||||
@ -611,6 +612,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||||||
|
|
||||||
this.isRejected = true;
|
this.isRejected = true;
|
||||||
this.error = reason || null;
|
this.error = reason || null;
|
||||||
|
this.exception = exception || null;
|
||||||
var errbacks = this.errbacks;
|
var errbacks = this.errbacks;
|
||||||
|
|
||||||
for (var i = 0, ii = errbacks.length; i < ii; i++) {
|
for (var i = 0, ii = errbacks.length; i < ii; i++) {
|
||||||
@ -629,7 +631,8 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||||||
callback.call(null, data);
|
callback.call(null, data);
|
||||||
} else if (this.isRejected && errback) {
|
} else if (this.isRejected && errback) {
|
||||||
var error = this.error;
|
var error = this.error;
|
||||||
errback.call(null, error);
|
var exception = this.exception;
|
||||||
|
errback.call(null, error, exception);
|
||||||
} else {
|
} else {
|
||||||
this.callbacks.push(callback);
|
this.callbacks.push(callback);
|
||||||
if (errback)
|
if (errback)
|
||||||
|
Loading…
Reference in New Issue
Block a user