From 7813d0780d174318c5ec20391e7ccf131ffcce77 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Jun 2024 17:45:38 +0200 Subject: [PATCH] Remove the `_ensureDownloadComplete` helper method in `web/app.js` After the previous commit this method has only a single call-site, hence we can inline the needed part of that check directly in `PDFViewerApplication.download` instead. --- web/app.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/web/app.js b/web/app.js index d8dd9e95389b9c..c965330a8fe3a6 100644 --- a/web/app.js +++ b/web/app.js @@ -1073,22 +1073,13 @@ const PDFViewerApplication = { ); }, - /** - * @private - */ - _ensureDownloadComplete() { - if (this.pdfDocument && this.downloadComplete) { - return; - } - throw new Error("PDF document not downloaded."); - }, - async download(options = {}) { let data; try { this._ensureDownloadComplete(); - - data = await this.pdfDocument.getData(); + if (this.downloadComplete) { + data = await this.pdfDocument.getData(); + } } catch { // When the PDF document isn't ready, or the PDF file is still // downloading, simply download using the URL.