From cba85bcee82f90dd4044564c6d926f3a8ce00af2 Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Mon, 17 Apr 2017 11:33:46 +1000 Subject: [PATCH] Fix Scruntinizer issues --- src/drivers/phantomjs/driver.js | 2 +- src/drivers/webextension/js/driver.js | 7 +++++-- src/drivers/webextension/js/i18n.js | 8 ++++---- src/drivers/webextension/js/popup.js | 5 +++++ src/wappalyzer.js | 3 --- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/drivers/phantomjs/driver.js b/src/drivers/phantomjs/driver.js index a949a762f..d7138b4b9 100644 --- a/src/drivers/phantomjs/driver.js +++ b/src/drivers/phantomjs/driver.js @@ -22,7 +22,7 @@ require('fs').changeWorkingDirectory(scriptDir); - require('system').args.forEach(function(arg, i) { + require('system').args.forEach(function(arg) { var value, arr = /^(--[^=]+)=(.+)$/.exec(arg); diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index a6070c747..4dee2dd54 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -148,7 +148,9 @@ } for ( var header in responseHeaders ) { - headersCache[uri][header] = responseHeaders[header]; + if ( responseHeaders.hasOwnProperty(header) ) { + headersCache[uri][header] = responseHeaders[header]; + } } } @@ -209,6 +211,7 @@ }; break; + default: } sendResponse(response); @@ -313,7 +316,7 @@ xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.onreadystatechange = function(e) { + xhr.onreadystatechange = function() { if ( xhr.readyState == 4 ) { w.log('w.driver.post: status ' + xhr.status + ' (' + url + ')'); } diff --git a/src/drivers/webextension/js/i18n.js b/src/drivers/webextension/js/i18n.js index 54e621131..1b69f9f58 100644 --- a/src/drivers/webextension/js/i18n.js +++ b/src/drivers/webextension/js/i18n.js @@ -2,12 +2,12 @@ document.addEventListener('DOMContentLoaded', function() { var - i, value, attr, - nodes = document.getElementsByTagName('*'); + i, value, + nodes = document.querySelector('*'); for ( i = 0; i < nodes.length; i ++ ) { - if ( attr = nodes[i].dataset.i18n ) { - nodes[i].innerHTML = browser.i18n.getMessage(attr); + if ( value = nodes[i].dataset.i18n ) { + nodes[i].innerHTML = browser.i18n.getMessage(value); } } }); diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index e9d57098c..70808bb53 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -1,3 +1,6 @@ +/** global: chrome */ +/** global: browser */ + document.addEventListener('DOMContentLoaded', function() { var slugify, popup, @@ -34,6 +37,8 @@ document.addEventListener('DOMContentLoaded', function() { var callback = function(tabs) { function sendGetApps(response) { + var html; + if ( response.tabCache && response.tabCache.count > 0 ) { detectedApps.innerHTML = ''; diff --git a/src/wappalyzer.js b/src/wappalyzer.js index 086b8181c..5fc96ede4 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -508,9 +508,6 @@ var wappalyzer = (function() { driver('ping'); } - apps = null; - data = null; - driver('displayApps'); } };