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

Revoke the blob-URLs used during printing in PDFPrintService

This commit is contained in:
Jonas Jenwald 2024-08-23 18:39:28 +02:00
parent 502a429e3e
commit 6a1b1ae6a4

View file

@ -199,10 +199,18 @@ class PDFPrintService {
wrapper.append(img);
this.printContainer.append(wrapper);
return new Promise(function (resolve, reject) {
img.onload = resolve;
img.onerror = reject;
});
const { promise, resolve, reject } = Promise.withResolvers();
img.onload = resolve;
img.onerror = reject;
promise
.catch(() => {
// Avoid "Uncaught promise" messages in the console.
})
.then(() => {
URL.revokeObjectURL(img.src);
});
return promise;
}
performPrint() {