1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #19558 from Snuffleupagus/RenderingCancelledException-null-#renderError

Reset `#renderError` on `RenderingCancelledException` (PR 19128 follow-up)
This commit is contained in:
Jonas Jenwald 2025-02-26 09:43:39 +01:00 committed by GitHub
commit 0e0872288e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -169,16 +169,18 @@ class BasePDFPageView {
await renderTask.promise;
this.#showCanvas?.(true);
} catch (e) {
error = e;
// When zooming with a `drawingDelay` set, avoid temporarily showing
// a black canvas if rendering was cancelled before the `onContinue`-
// callback had been invoked at least once.
if (error instanceof RenderingCancelledException) {
if (e instanceof RenderingCancelledException) {
return;
}
error = e;
this.#showCanvas?.(true);
} finally {
this.#renderError = error;
// The renderTask may have been replaced by a new one, so only remove
// the reference to the renderTask if it matches the one that is
// triggering this callback.
@ -186,8 +188,6 @@ class BasePDFPageView {
this.renderTask = null;
}
}
this.#renderError = error;
this.renderingState = RenderingStates.FINISHED;
onFinish(renderTask);