Performance improvements

main
Elbert Alias 2 years ago
parent d837d9421c
commit c7417f1b89

@ -131,7 +131,20 @@ function getDom(page, technologies = Wappalyzer.technologies) {
dom[selector].forEach(({ exists, text, properties, attributes }) => {
nodes.forEach((node) => {
if (exists) {
if (
technologies.filter(({ name: _name }) => _name === name)
.length >= 50
) {
return
}
if (
exists &&
technologies.findIndex(
({ name: _name, selector: _selector, exists }) =>
name === _name && selector === _selector && exists === ''
) === -1
) {
technologies.push({
name,
selector,
@ -140,9 +153,18 @@ function getDom(page, technologies = Wappalyzer.technologies) {
}
if (text) {
const value = node.textContent.trim()
// eslint-disable-next-line unicorn/prefer-text-content
const value = (
node.textContent ? node.textContent.trim() : ''
).slice(0, 1000000)
if (value) {
if (
value &&
technologies.findIndex(
({ name: _name, selector: _selector, text }) =>
name === _name && selector === _selector && text === value
) === -1
) {
technologies.push({
name,
selector,
@ -153,7 +175,21 @@ function getDom(page, technologies = Wappalyzer.technologies) {
if (properties) {
Object.keys(properties).forEach((property) => {
if (Object.prototype.hasOwnProperty.call(node, property)) {
if (
Object.prototype.hasOwnProperty.call(node, property) &&
technologies.findIndex(
({
name: _name,
selector: _selector,
property: _property,
value,
}) =>
name === _name &&
selector === _selector &&
property === _property &&
value === toScalar(value)
) === -1
) {
const value = node[property]
if (typeof value !== 'undefined') {
@ -170,7 +206,21 @@ function getDom(page, technologies = Wappalyzer.technologies) {
if (attributes) {
Object.keys(attributes).forEach((attribute) => {
if (node.hasAttribute(attribute)) {
if (
node.hasAttribute(attribute) &&
technologies.findIndex(
({
name: _name,
selector: _selector,
attribute: _atrribute,
value,
}) =>
name === _name &&
selector === _selector &&
attribute === _atrribute &&
value === toScalar(value)
) === -1
) {
const value = node.getAttribute(attribute)
technologies.push({

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com/",
"version": "6.10.45",
"version": "6.10.46",
"author": "Wappalyzer",
"license": "MIT",
"repository": {

@ -71,9 +71,22 @@ async function getDom(technologies) {
return
}
dom[selector].forEach(({ exists, text, attributes }) => {
dom[selector].forEach(({ exists, text, properties, attributes }) => {
nodes.forEach((node) => {
if (exists) {
if (
technologies.filter(({ name: _name }) => _name === name).length >=
50
) {
return
}
if (
exists &&
technologies.findIndex(
({ name: _name, selector: _selector, exists }) =>
name === _name && selector === _selector && exists === ''
) === -1
) {
technologies.push({
name,
selector,
@ -83,9 +96,18 @@ async function getDom(technologies) {
if (text) {
// eslint-disable-next-line unicorn/prefer-text-content
const value = node.innerText ? node.innerText.trim() : ''
const value = (node.innerText ? node.innerText.trim() : '').slice(
0,
1000000
)
if (value) {
if (
value &&
technologies.findIndex(
({ name: _name, selector: _selector, text }) =>
name === _name && selector === _selector && text === value
) === -1
) {
technologies.push({
name,
selector,
@ -94,9 +116,54 @@ async function getDom(technologies) {
}
}
if (properties) {
Object.keys(properties).forEach((property) => {
if (
Object.prototype.hasOwnProperty.call(node, property) &&
technologies.findIndex(
({
name: _name,
selector: _selector,
property: _property,
value,
}) =>
name === _name &&
selector === _selector &&
property === _property &&
value === toScalar(value)
) === -1
) {
const value = node[property]
if (typeof value !== 'undefined') {
technologies.push({
name,
selector,
property,
value: toScalar(value),
})
}
}
})
}
if (attributes) {
Object.keys(attributes).forEach((attribute) => {
if (node.hasAttribute(attribute)) {
if (
node.hasAttribute(attribute) &&
technologies.findIndex(
({
name: _name,
selector: _selector,
attribute: _atrribute,
value,
}) =>
name === _name &&
selector === _selector &&
attribute === _atrribute &&
value === toScalar(value)
) === -1
) {
const value = node.getAttribute(attribute)
technologies.push({

@ -286,8 +286,6 @@ const Popup = {
return templates
}, {})
Popup.onGetDetections()
// Disabled domains
const dynamicIcon = await getOption('dynamicIcon', false)

@ -4,7 +4,7 @@
"author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com/",
"description": "Identify web technologies",
"version": "6.10.45",
"version": "6.10.46",
"default_locale": "en",
"manifest_version": 2,
"icons": {

@ -4,7 +4,7 @@
"author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com/",
"description": "Identify web technologies",
"version": "6.10.45",
"version": "6.10.46",
"default_locale": "en",
"manifest_version": 3,
"icons": {

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com/",
"version": "6.10.45",
"version": "6.10.46",
"author": "Wappalyzer",
"license": "MIT",
"repository": {

@ -344,9 +344,9 @@
"js": {
"OktaAuth": "",
"isOktaEnabled": "",
"oktaCurrentSessionUrl": "",
"okta.cdnUrlHostname": "",
"okta.locale": ""
"okta.locale": "",
"oktaCurrentSessionUrl": ""
},
"pricing": [
"poa",