Only define the validateFileURL variable in GENERIC builds

There's no point in having this variable defined (implicitly) as `undefined` in e.g. the Firefox PDF Viewer.
By defining it with `var` and using an ESLint ignore, rather than `let`, we can move it into the relevant pre-processor block instead. Note that since the entire viewer-code is placed, by Webpack, in a top-level closure this variable will thus not become globally accessible.
This commit is contained in:
Jonas Jenwald 2022-09-13 14:07:17 +02:00
parent 5a6cdffb4b
commit 0988915d06

View File

@ -2178,14 +2178,14 @@ const PDFViewerApplication = {
},
};
let validateFileURL;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
const HOSTED_VIEWER_ORIGINS = [
"null",
"http://mozilla.github.io",
"https://mozilla.github.io",
];
validateFileURL = function (file) {
// eslint-disable-next-line no-var
var validateFileURL = function (file) {
if (!file) {
return;
}