mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Attempt to clean-up/restore pending rendering operations when errors occurs while a RenderTask
runs (PR 10202 follow-up)
This piggybacks of the existing `cancel` functionality, to ensure that any pending operations are closed *and* that any temporary canvases are actually being removed. Also simplifies `finishPaintTask` in `PDFPageView.draw` slightly, by converting it to an async function.
This commit is contained in:
parent
40863eb275
commit
5081063b9e
2 changed files with 8 additions and 9 deletions
|
@ -432,7 +432,7 @@ class PDFPageView {
|
|||
};
|
||||
}
|
||||
|
||||
let finishPaintTask = (error) => {
|
||||
const finishPaintTask = async (error) => {
|
||||
// The paintTask may have been replaced by a new one, so only remove
|
||||
// the reference to the paintTask if it matches the one that is
|
||||
// triggering this callback.
|
||||
|
@ -442,7 +442,7 @@ class PDFPageView {
|
|||
|
||||
if (error instanceof RenderingCancelledException) {
|
||||
this.error = null;
|
||||
return Promise.resolve(undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
this.renderingState = RenderingStates.FINISHED;
|
||||
|
@ -465,9 +465,8 @@ class PDFPageView {
|
|||
});
|
||||
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
throw error;
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
};
|
||||
|
||||
let paintTask = this.renderer === RendererType.SVG ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue