Skip to content

Commit

Permalink
Reset #renderError on RenderingCancelledException (PR 19128 follo…
Browse files Browse the repository at this point in the history
…w-up)

This restores the behaviour that existed prior to PR 19128, since `RenderingCancelledException` should still overwrite any previously seen Error.
  • Loading branch information
Snuffleupagus committed Feb 25, 2025
1 parent aa70b28 commit 6fae111
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/base_pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,25 +169,25 @@ 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.
if (renderTask === this.renderTask) {
this.renderTask = null;
}
}
this.#renderError = error;

this.renderingState = RenderingStates.FINISHED;

onFinish(renderTask);
Expand Down

0 comments on commit 6fae111

Please sign in to comment.