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:
parent
502a429e3e
commit
6a1b1ae6a4
1 changed files with 12 additions and 4 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue