From 0988915d0656f92faa7c711c6abecfffeecfa8a7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 13 Sep 2022 14:07:17 +0200 Subject: [PATCH] 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. --- web/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app.js b/web/app.js index 880cb43d8..821bf29ce 100644 --- a/web/app.js +++ b/web/app.js @@ -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; }