Merge pull request #3549 from brendandahl/uhandled-stack

Dump the stack with unhandled rejections.
This commit is contained in:
Yury Delendik 2013-08-07 07:05:39 -07:00
commit 44184a1d5b

View File

@ -770,8 +770,12 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
var now = Date.now(); var now = Date.now();
for (var i = 0; i < this.unhandledRejections.length; i++) { for (var i = 0; i < this.unhandledRejections.length; i++) {
if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
warn('Unhandled rejection: ' + var unhandled = this.unhandledRejections[i].promise._value;
this.unhandledRejections[i].promise._value); var msg = 'Unhandled rejection: ' + unhandled;
if (unhandled.stack) {
msg += '\n' + unhandled.stack;
}
warn(msg);
this.unhandledRejections.splice(i); this.unhandledRejections.splice(i);
i--; i--;
} }