From f4912db2ae58cec0c2e9b6e302f0ae6e6c15d252 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 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/web/app.js b/web/app.js index d8dd9e953..8bcb86f20 100644 --- a/web/app.js +++ b/web/app.js @@ -1073,22 +1073,12 @@ 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.