From a177afc206dfe69188b5e5749bd2c9ff6b12184c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 1 Nov 2020 11:46:10 +0100 Subject: [PATCH] Fix some static static analyzer warnings (issue 11965) This fixes only those warnings, as reported by https://lgtm.com/projects/g/mozilla/pdf.js?mode=list, that make sense (as far as I'm concerned). Hence this patch leaves the following things unaddressed: - The "recommendation"-category, since it only complains about unused variables. However, note that all of those cases are purposely included and that there's thus ESLint-disable comments added to explictly allow them. - The "warning"-category, which still contains two complaints. However, as far as I can tell, they are both false positives. Given first of all the false positives of the LGTM static analyzer, and secondly that we'd need to add (essentially duplicated) disable-comments for the unused variable cases, it's not entirely clear to me if we actually want to work towards including LGTM in the PDF.js project (e.g. running alongside Travis) or if we should just close issue 11965. --- src/shared/fonts_utils.js | 2 +- web/chromecom.js | 2 +- web/debugger.js | 1 - web/firefoxcom.js | 2 +- web/genericcom.js | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shared/fonts_utils.js b/src/shared/fonts_utils.js index baa46ffc0..553cc8ea0 100644 --- a/src/shared/fonts_utils.js +++ b/src/shared/fonts_utils.js @@ -120,7 +120,7 @@ function readFontDictData(aString, aMap) { var fontDictDataTokens = []; var count = aString.length; - for (var i = 0; i < count; i) { + for (var i = 0; i < count; ) { var value = aString[i++] | 0; var token = null; diff --git a/web/chromecom.js b/web/chromecom.js index c18d73a04..df055fb17 100644 --- a/web/chromecom.js +++ b/web/chromecom.js @@ -418,7 +418,7 @@ class ChromeExternalServices extends DefaultExternalServices { } static createDownloadManager(options) { - return new DownloadManager(options); + return new DownloadManager(); } static createPreferences() { diff --git a/web/debugger.js b/web/debugger.js index 500522d84..26f403303 100644 --- a/web/debugger.js +++ b/web/debugger.js @@ -381,7 +381,6 @@ var Stepper = (function StepperClosure() { line.appendChild(c("td", JSON.stringify(simplifyArgs(decArgs)))); } if (operatorsToDisplay < operatorList.fnArray.length) { - line = c("tr"); var lastCell = c("td", "..."); lastCell.colspan = 4; chunk.appendChild(lastCell); diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 352987e22..de080518b 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -347,7 +347,7 @@ class FirefoxExternalServices extends DefaultExternalServices { } static createDownloadManager(options) { - return new DownloadManager(options); + return new DownloadManager(); } static createPreferences() { diff --git a/web/genericcom.js b/web/genericcom.js index ef81fabdf..8c3087284 100644 --- a/web/genericcom.js +++ b/web/genericcom.js @@ -39,7 +39,7 @@ class GenericPreferences extends BasePreferences { class GenericExternalServices extends DefaultExternalServices { static createDownloadManager(options) { - return new DownloadManager(options); + return new DownloadManager(); } static createPreferences() {