Only define the webViewerFileInputChange/webViewerOpenFile variables in GENERIC builds

There's no point in having these variables defined (implicitly) as `undefined` in e.g. the Firefox PDF Viewer.
By defining them with `var` and using ESList ignores, rather than `let`, we can move them into the relevant pre-processor block instead. Note that since the entire viewer-code is placed, by Webpack, in a top-level closure these variables will thus *not* become globally accessible.
This commit is contained in:
Jonas Jenwald 2022-04-29 17:36:52 +02:00
parent 7cce41c26d
commit 9268924a15

View File

@ -2424,9 +2424,9 @@ function webViewerHashchange(evt) {
}
}
let webViewerFileInputChange, webViewerOpenFile;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
webViewerFileInputChange = function (evt) {
// eslint-disable-next-line no-var
var webViewerFileInputChange = function (evt) {
if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {
return; // Opening a new PDF file isn't supported in Presentation Mode.
}
@ -2439,7 +2439,8 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
PDFViewerApplication.open(url);
};
webViewerOpenFile = function (evt) {
// eslint-disable-next-line no-var
var webViewerOpenFile = function (evt) {
const fileInput = PDFViewerApplication.appConfig.openFileInput;
fileInput.click();
};