From cae8fe4c7e930f63b2c03a95e23f8cfbaa2a2602 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 2 Jul 2023 11:12:27 +0200 Subject: [PATCH] Move the `setTitleUsingUrl`-call into `PDFViewerApplication.initPassiveLoading` This seems overall nicer, rather than having to "manually" call this when initializing passive loading. --- web/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/app.js b/web/app.js index af7f06870..3c607a014 100644 --- a/web/app.js +++ b/web/app.js @@ -768,13 +768,15 @@ const PDFViewerApplication = { return this.externalServices.supportedMouseWheelZoomModifierKeys; }, - initPassiveLoading() { + initPassiveLoading(file) { if ( typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL || CHROME") ) { throw new Error("Not implemented: initPassiveLoading"); } + this.setTitleUsingUrl(file, /* downloadUrl = */ file); + this.externalServices.initPassiveLoading({ onOpenWithTransport: range => { this.open({ range }); @@ -2285,8 +2287,7 @@ function webViewerInitialized() { PDFViewerApplication._hideViewBookmark(); } } else if (PDFJSDev.test("MOZCENTRAL || CHROME")) { - PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file); - PDFViewerApplication.initPassiveLoading(); + PDFViewerApplication.initPassiveLoading(file); } else { throw new Error("Not implemented: webViewerInitialized"); }