Merge pull request #16551 from Snuffleupagus/page-destroyed-complete
Ensure that `cleanup` during rendering is actually ignored, to prevent a blank canvas
This commit is contained in:
commit
877884029d
@ -1524,7 +1524,7 @@ class PDFPageProxy {
|
|||||||
optionalContentConfigPromise,
|
optionalContentConfigPromise,
|
||||||
])
|
])
|
||||||
.then(([transparency, optionalContentConfig]) => {
|
.then(([transparency, optionalContentConfig]) => {
|
||||||
if (this.#pendingCleanup) {
|
if (this.destroyed) {
|
||||||
complete();
|
complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1727,7 +1727,7 @@ class PDFPageProxy {
|
|||||||
#tryCleanup(delayed = false) {
|
#tryCleanup(delayed = false) {
|
||||||
this.#abortDelayedCleanup();
|
this.#abortDelayedCleanup();
|
||||||
|
|
||||||
if (!this.#pendingCleanup) {
|
if (!this.#pendingCleanup || this.destroyed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (delayed) {
|
if (delayed) {
|
||||||
|
@ -3203,6 +3203,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
const renderTask = pdfPage.render({
|
const renderTask = pdfPage.render({
|
||||||
canvasContext: canvasAndCtx.context,
|
canvasContext: canvasAndCtx.context,
|
||||||
viewport,
|
viewport,
|
||||||
|
background: "#FF0000", // See comment below.
|
||||||
});
|
});
|
||||||
expect(renderTask instanceof RenderTask).toEqual(true);
|
expect(renderTask instanceof RenderTask).toEqual(true);
|
||||||
|
|
||||||
@ -3225,6 +3226,11 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
await renderTask.promise;
|
await renderTask.promise;
|
||||||
expect(renderTask.separateAnnots).toEqual(false);
|
expect(renderTask.separateAnnots).toEqual(false);
|
||||||
|
|
||||||
|
// Use the red background-color to, more easily, tell that the page was
|
||||||
|
// actually rendered successfully.
|
||||||
|
const { data } = canvasAndCtx.context.getImageData(0, 0, 1, 1);
|
||||||
|
expect(data).toEqual(new Uint8ClampedArray([255, 0, 0, 255]));
|
||||||
|
|
||||||
CanvasFactory.destroy(canvasAndCtx);
|
CanvasFactory.destroy(canvasAndCtx);
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user