Merge pull request #8992 from Snuffleupagus/RenderingCancelledException-API-2

[api-major] When rendering is cancelled, always reject with `RenderingCancelledException`
This commit is contained in:
Tim van der Meij 2017-10-05 22:51:57 +02:00 committed by GitHub
commit b9662e97d2
3 changed files with 6 additions and 21 deletions

View File

@ -2260,14 +2260,8 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
if (this._canvas) {
canvasInRendering.delete(this._canvas);
}
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PDFJS_NEXT')) ||
getDefaultSetting('pdfjsNext')) {
this.callback(new RenderingCancelledException(
'Rendering cancelled, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
this.callback(new RenderingCancelledException(
'Rendering cancelled, page ' + this.pageNumber, 'canvas'));
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {

View File

@ -407,9 +407,7 @@ class PDFPageView {
this.paintTask = null;
}
if (((typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||
error instanceof RenderingCancelledException) {
if (error instanceof RenderingCancelledException) {
this.error = null;
return Promise.resolve(undefined);
}
@ -589,13 +587,8 @@ class PDFPageView {
let cancelled = false;
let ensureNotCancelled = () => {
if (cancelled) {
if ((typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('PDFJS_NEXT')) || PDFJS.pdfjsNext) {
throw new RenderingCancelledException(
'Rendering cancelled, page ' + this.id, 'svg');
} else {
throw 'cancelled'; // eslint-disable-line no-throw-literal
}
throw new RenderingCancelledException(
'Rendering cancelled, page ' + this.id, 'svg');
}
};

View File

@ -303,9 +303,7 @@ class PDFThumbnailView {
this.renderTask = null;
}
if (((typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||
error instanceof RenderingCancelledException) {
if (error instanceof RenderingCancelledException) {
renderCapability.resolve(undefined);
return;
}