From 4886a7cf69e8fe4c92242a730e35889cde8592d7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 17 Nov 2020 13:37:21 +0100 Subject: [PATCH] Skip `Promise.all` in `PDFViewerApplication._parseHashParameters` unless actually necessary Given that only two debugging hash parameters (i.e. `disableWorker` and `pdfBug`) will make this method asynchronous, we can avoid what's most of the time is an unnecessary `Promise.all` invocation. --- web/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/app.js b/web/app.js index d07853f6c..2ecc49e4c 100644 --- a/web/app.js +++ b/web/app.js @@ -385,6 +385,9 @@ const PDFViewerApplication = { AppOptions.set("locale", hashParams.locale); } + if (waitOn.length === 0) { + return undefined; + } return Promise.all(waitOn).catch(reason => { console.error(`_parseHashParameters: "${reason.message}".`); });