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