From 03d649b3ea55a3368a4d67e637d42e8451eec59f Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 18 Mar 2017 21:44:19 +0100 Subject: [PATCH] Fix various warnings found by scrutinity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Some functions didn't return anything - Some `for…in` related variables weren't declared - Some variables were unused --- src/drivers/chrome/js/driver.js | 4 ++-- src/drivers/chrome/js/options.js | 6 +++--- src/drivers/firefox/data/js/tab.js | 6 +----- src/drivers/webextension/js/driver.js | 4 ++-- src/drivers/webextension/js/iframe.js | 4 ++-- src/wappalyzer.js | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/drivers/chrome/js/driver.js b/src/drivers/chrome/js/driver.js index 3b0fa13ff..d2ec6ae29 100644 --- a/src/drivers/chrome/js/driver.js +++ b/src/drivers/chrome/js/driver.js @@ -54,7 +54,7 @@ firstRun = true; // Set defaults - for ( option in defaults ) { + for ( var option in defaults ) { localStorage[option] = defaults[option]; } } else if ( version !== localStorage['version'] && parseInt(localStorage['upgradeMessage'], 10) ) { @@ -189,7 +189,7 @@ if ( count > 0 ) { // Find the main application to display - var i, appName, found = false; + var appName, found = false; w.driver.categoryOrder.forEach(function(match) { for ( appName in w.detected[url] ) { diff --git a/src/drivers/chrome/js/options.js b/src/drivers/chrome/js/options.js index 7ee9be839..92d1fe3f7 100644 --- a/src/drivers/chrome/js/options.js +++ b/src/drivers/chrome/js/options.js @@ -15,9 +15,9 @@ document.addEventListener('DOMContentLoaded', function() { }, load: function() { - for ( option in options.opts ) { - if ( value = localStorage[option] ) { - options.opts[option] = value; + for ( var option in options.opts ) { + if ( localStorage[option] ) { + options.opts[option] = localStorage[option]; } } diff --git a/src/drivers/firefox/data/js/tab.js b/src/drivers/firefox/data/js/tab.js index eafd3c507..72719ec2b 100644 --- a/src/drivers/firefox/data/js/tab.js +++ b/src/drivers/firefox/data/js/tab.js @@ -1,11 +1,7 @@ (function() { - var lastEnv = []; - try { if ( document && document.contentType === 'text/html' ) { - var - html = new XMLSerializer().serializeToString(document), - env = []; // TODO: Remove, `env` not used in this scope? + var html = new XMLSerializer().serializeToString(document), self.port.emit('log', html); diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 9519d680d..f5583a670 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -54,7 +54,7 @@ firstRun = true; // Set defaults - for ( option in defaults ) { + for ( var option in defaults ) { localStorage[option] = defaults[option]; } } else if ( version !== localStorage['version'] && parseInt(localStorage['upgradeMessage'], 10) ) { @@ -195,7 +195,7 @@ if ( count > 0 ) { // Find the main application to display - var i, appName, found = false; + var appName, found = false; w.driver.categoryOrder.forEach(function(match) { for ( appName in w.detected[url] ) { diff --git a/src/drivers/webextension/js/iframe.js b/src/drivers/webextension/js/iframe.js index 70f6fc408..fcf40539f 100644 --- a/src/drivers/webextension/js/iframe.js +++ b/src/drivers/webextension/js/iframe.js @@ -112,8 +112,6 @@ var exports = {}; try { dict[key] = window.decodeURIComponent(val); } catch (e) { - - continue; } } return dict; @@ -307,6 +305,7 @@ var exports = {}; return div; } } + return null; }; TopSearcher.prototype._jumpedOut = function(el) { @@ -988,6 +987,7 @@ var exports = {}; } } } + return null; } function onPostMessage(event) { diff --git a/src/wappalyzer.js b/src/wappalyzer.js index 7bddd6930..8eb4f289f 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -242,7 +242,7 @@ var wappalyzer = (function() { */ analyze: function(hostname, url, data) { var - i, j, app, confidence, type, regexMeta, regexScript, match, content, meta, header, version, id, + i, app, confidence, type, regexMeta, regexScript, match, content, meta, header, version, id, profiler = new Profiler(), apps = {}, excludes = [],