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

Reset #renderError on RenderingCancelledException (PR 19128 follow-up)

This restores the behaviour that existed prior to PR 19128, see e.g. 8727a04ae5/web/pdf_page_view.js (L908-L911), since `RenderingCancelledException` should still overwrite any previously seen Error.
This commit is contained in:
Jonas Jenwald 2025-02-25 16:29:49 +01:00
parent aa70b28365
commit d50d3b0b0e

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);