mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Ensure that cleanup
during rendering is actually ignored, to prevent a blank canvas
The existing unit-test doesn't work as intended, since the page never actually renders. Note how `cleanup` is *not* allowed to run when parsing and/or rendering is ongoing, however an (old) incorrect condition could prevent rendering from ever starting. This is very old code, which has been slightly re-factored a couple of times (many years ago), however this doesn't appear to affect e.g. the default viewer since the incorrect behaviour seem highly dependent on "unlucky" timing. Note also how at the start of the `PDFPageProxy.prototype.render`-method we purposely cancel any pending `cleanup`-call, to prevent unnecessary re-parsing for multiple sequential `render`-calls. Finally, avoid running `cleanup` when document/page destruction has already started since it's pointless in that case.
This commit is contained in:
parent
9af50dc358
commit
a591c3de84
2 changed files with 8 additions and 2 deletions
|
@ -1524,7 +1524,7 @@ class PDFPageProxy {
|
|||
optionalContentConfigPromise,
|
||||
])
|
||||
.then(([transparency, optionalContentConfig]) => {
|
||||
if (this.#pendingCleanup) {
|
||||
if (this.destroyed) {
|
||||
complete();
|
||||
return;
|
||||
}
|
||||
|
@ -1727,7 +1727,7 @@ class PDFPageProxy {
|
|||
#tryCleanup(delayed = false) {
|
||||
this.#abortDelayedCleanup();
|
||||
|
||||
if (!this.#pendingCleanup) {
|
||||
if (!this.#pendingCleanup || this.destroyed) {
|
||||
return false;
|
||||
}
|
||||
if (delayed) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue