Move the setTitleUsingUrl-call into PDFViewerApplication.initPassiveLoading

This seems overall nicer, rather than having to "manually" call this when initializing passive loading.
This commit is contained in:
Jonas Jenwald 2023-07-02 11:12:27 +02:00
parent 73b6ee5325
commit cae8fe4c7e

View File

@ -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");
}