Replaced null with type checks

main
Elbert Alias 12 years ago
parent b5e54dd55f
commit adc9d6eae5

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -94,7 +94,7 @@
if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) { if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
if ( request.nsIHttpChannel && request.contentType == 'text/html' ) { if ( request.nsIHttpChannel && request.contentType == 'text/html' ) {
if ( progress.currentURI && request.name == progress.currentURI.spec ) { if ( progress.currentURI && request.name == progress.currentURI.spec ) {
var headers = new Object(); var headers = {};
request.nsIHttpChannel.visitResponseHeaders(function(header, value) { request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
headers[header] = value; headers[header] = value;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

@ -51,7 +51,7 @@ var wappalyzer = (function() {
*/ */
log: function(message, type) { log: function(message, type) {
if ( w.config.environment === 'dev' ) { if ( w.config.environment === 'dev' ) {
if ( type == null ) { type = 'debug'; } if ( typeof type === 'undefined' ) { type = 'debug'; }
driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type });
} }
@ -64,7 +64,7 @@ var wappalyzer = (function() {
w.log('w.init'); w.log('w.init');
// Checks // Checks
if ( w.driver == null ) { if ( typeof w.driver === 'undefined' ) {
w.log('no driver, exiting'); w.log('no driver, exiting');
return; return;
@ -96,13 +96,13 @@ var wappalyzer = (function() {
data.url = url; data.url = url;
if ( w.apps == null || w.categories == null ) { if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) {
w.log('apps.json not loaded'); w.log('apps.json not loaded');
return; return;
} }
if ( w.detected[url] == null ) { if ( typeof w.detected[url] === 'undefined' ) {
w.detected[url] = []; w.detected[url] = [];
} }
@ -110,9 +110,9 @@ var wappalyzer = (function() {
i, app, type, regex, regexMeta, regexScript, match, content, meta, header, i, app, type, regex, regexMeta, regexScript, match, content, meta, header,
profiler = { profiler = {
regexCount: 0, regexCount: 0,
startTime: ( new Date ).getTime() startTime: new Date().getTime()
}, },
apps = [] apps = []
; ;
appLoop: appLoop:
@ -137,7 +137,7 @@ var wappalyzer = (function() {
break; break;
case 'html': case 'html':
if ( data[type] == null ) { if ( typeof data[type] !== 'string' || !data.html ) {
break; break;
} }
@ -153,7 +153,7 @@ var wappalyzer = (function() {
break; break;
case 'script': case 'script':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -174,7 +174,7 @@ var wappalyzer = (function() {
break; break;
case 'meta': case 'meta':
if ( data.html == null ) { if ( typeof data.html !== 'string' || !data.html ) {
break; break;
} }
@ -204,7 +204,7 @@ var wappalyzer = (function() {
break; break;
case 'headers': case 'headers':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -213,7 +213,7 @@ var wappalyzer = (function() {
profiler.regexCount ++; profiler.regexCount ++;
if ( data[type][header] != null && regex.test(data[type][header]) ) { if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) {
apps.push(app); apps.push(app);
continue appLoop; continue appLoop;
@ -222,7 +222,7 @@ var wappalyzer = (function() {
break; break;
case 'env': case 'env':
if ( data[type] == null ) { if ( typeof data[type] !== 'object' || !data[type] ) {
break; break;
} }
@ -299,10 +299,10 @@ var wappalyzer = (function() {
// Additional information // Additional information
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
if ( data.html != null ) { if ( typeof data.html === 'string' && data.html ) {
match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); match = data.html.match(/<html[^>]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i);
if ( match != null && match.length ) { if ( match.length ) {
w.ping.hostnames[hostname].meta['language'] = match[1]; w.ping.hostnames[hostname].meta['language'] = match[1];
} }
@ -322,7 +322,7 @@ var wappalyzer = (function() {
w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname]));
} }
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
apps = null; apps = null;
data = null; data = null;

Loading…
Cancel
Save