Fix Srutinizer issues

main
Elbert Alias 6 years ago
parent 5b911327f5
commit cd0b1b6e60

@ -1,6 +1,24 @@
(() => { (() => {
try { try {
addEventListener('message', onMessage); const detectJs = chain => {
const properties = chain.split('.');
let value = properties.length ? window : null;
for ( let i = 0; i < properties.length; i ++ ) {
let property = properties[i];
if ( value && value.hasOwnProperty(property) ) {
value = value[property];
} else {
value = null;
break;
}
}
return typeof value === 'string' || typeof value === 'number' ? value : !!value;
};
const onMessage = event => { const onMessage = event => {
if ( event.data.id !== 'patterns' ) { if ( event.data.id !== 'patterns' ) {
@ -36,25 +54,7 @@
postMessage({ id: 'js', js }, '*'); postMessage({ id: 'js', js }, '*');
}; };
const detectJs = chain => { addEventListener('message', onMessage);
const properties = chain.split('.');
let value = properties.length ? window : null;
for ( let i = 0; i < properties.length; i ++ ) {
let property = properties[i];
if ( value && value.hasOwnProperty(property) ) {
value = value[property];
} else {
value = null;
break;
}
}
return typeof value === 'string' || typeof value === 'number' ? value : !!value;
};
} catch(e) { } catch(e) {
// Fail quietly // Fail quietly
} }

@ -91,7 +91,7 @@ function appsToDomTemplate(response) {
for ( let cat in categories ) { for ( let cat in categories ) {
const apps = []; const apps = [];
for ( appName in categories[cat].apps ) { for ( let appName in categories[cat].apps ) {
let confidence = response.tabCache.detected[appName].confidenceTotal; let confidence = response.tabCache.detected[appName].confidenceTotal;
let version = response.tabCache.detected[appName].version; let version = response.tabCache.detected[appName].version;

@ -123,7 +123,7 @@ class Wappalyzer {
this.driver.displayApps(this.detected[url.canonical], { language }, context); this.driver.displayApps(this.detected[url.canonical], { language }, context);
resolve(); return resolve();
}); });
}); });
} }
@ -152,7 +152,7 @@ class Wappalyzer {
return reject(); return reject();
} }
resolve(); return resolve();
}, () => resolve()); }, () => resolve());
}); });
}; };

Loading…
Cancel
Save