From 07ac5c337f695261c423dedb32699cfecb2586fd Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 10 Apr 2022 12:50:35 +0200 Subject: [PATCH] [GENERIC viewer] Remove some, now unnecessary, checks used with `fileInput` According to the MDN compatibility data, see below, all of these features have been supported for years and years in all browsers. Looking closely at the data, the most likely reason for adding these checks in the first place was for IE 9 compatibility (since we originally "supported" that browser). - https://developer.mozilla.org/en-US/docs/Web/API/File#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/FileReader#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/FileList#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/Blob#browser_compatibility --- web/app.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/web/app.js b/web/app.js index 16e8637bf..8134c6817 100644 --- a/web/app.js +++ b/web/app.js @@ -2085,7 +2085,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { "https://mozilla.github.io", ]; validateFileURL = function (file) { - if (file === undefined) { + if (!file) { return; } try { @@ -2157,17 +2157,7 @@ function webViewerInitialized() { if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { const fileInput = appConfig.openFileInput; - if ( - !window.File || - !window.FileReader || - !window.FileList || - !window.Blob - ) { - appConfig.toolbar.openFile.hidden = true; - appConfig.secondaryToolbar.openFileButton.hidden = true; - } else { - fileInput.value = null; - } + fileInput.value = null; fileInput.addEventListener("change", function (evt) { const { files } = evt.target;