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) { if (this._canvas) {
canvasInRendering.delete(this._canvas); canvasInRendering.delete(this._canvas);
} }
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PDFJS_NEXT')) ||
getDefaultSetting('pdfjsNext')) {
this.callback(new RenderingCancelledException( this.callback(new RenderingCancelledException(
'Rendering cancelled, page ' + this.pageNumber, 'canvas')); 'Rendering cancelled, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
}, },
operatorListChanged: function InternalRenderTask_operatorListChanged() { operatorListChanged: function InternalRenderTask_operatorListChanged() {

View File

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

View File

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