From 8f06b60edd02620f635764c27ec3fa5c6f66f8a4 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Wed, 2 Jun 2021 10:59:28 +1000 Subject: [PATCH] Fixed memory leak and popup not updating after navigation --- src/drivers/npm/driver.js | 4 +-- src/drivers/npm/package.json | 2 +- src/drivers/webextension/js/driver.js | 36 +++++++++++++++++++------- src/drivers/webextension/manifest.json | 2 +- src/package.json | 2 +- src/technologies.json | 4 +-- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index fe34e1442..8c94a6271 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -842,9 +842,9 @@ class Site { } if (this.options.probe && !this.probed) { - await this.probe(url) - this.probed = true + + await this.probe(url) } } catch (error) { this.analyzedUrls[url.href] = { diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index b1cbd5ef7..260ea8569 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com/", - "version": "6.7.2", + "version": "6.7.3", "author": "Wappalyzer", "license": "MIT", "repository": { diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index da346bacd..65dc66878 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -15,7 +15,7 @@ const { agent, promisify, getOption, setOption, open, globEscape } = Utils const expiry = 1000 * 60 * 60 * 24 const hostnameIgnoreList = - /\b((local|dev(elop(ment)?)?|stag(e|ing)?|preprod|preview|test(ing)?|[^a-z]demo(shop)?|cache)[.-]|localhost|((wappalyzer|google|facebook|twitter|reddit|yahoo|wikipedia|amazon|youtube)\.)|\.local|\.test|\.netlify\.app|\.shopifypreview\.com|^[0-9.]+|[\d.]+$|^([a-f0-9:]+:+)+[a-f0-9]+$)/ + /\b((local|dev(elop(ment)?)?|stag(e|ing)?|preprod|preview|test(ing)?|[^a-z]demo(shop)?|cache)[.-]|localhost|((wappalyzer|google|facebook|twitter|reddit|yahoo|wikipedia|amazon|youtube)\.)|\.local|\.test|\.netlify\.app|\.shopifypreview\.com|^([0-9.]+|[\d.]+)$|^([a-f0-9:]+:+)+[a-f0-9]+$)/ const xhrDebounce = [] @@ -74,7 +74,19 @@ const Driver = { types: ['xmlhttprequest'], }) - chrome.tabs.onRemoved.addListener((id) => (Driver.cache.tabs[id] = null)) + chrome.tabs.onRemoved.addListener((id) => delete Driver.cache.tabs[id]) + + chrome.tabs.onUpdated.addListener(async (id, { url }) => { + if (url) { + const { hostname } = new URL(url) + + const cache = Driver.cache.hostnames[hostname] + + Driver.cache.tabs[id] = cache ? resolve(cache.detections) : [] + + await Driver.setIcon(url, Driver.cache.tabs[id]) + } + }) // Enable messaging between scripts chrome.runtime.onMessage.addListener(Driver.onMessage) @@ -434,14 +446,14 @@ const Driver = { cache.detections = cache.detections .concat(detections) .filter(({ technology }) => technology) - - cache.detections.filter( - ({ technology: { name }, pattern: { regex } }, index) => - cache.detections.findIndex( - ({ technology: { name: _name }, pattern: { regex: _regex } }) => - name === _name && (!regex || regex.toString() === _regex.toString()) - ) === index - ) + .filter( + ({ technology: { name }, pattern: { regex } }, index) => + cache.detections.findIndex( + ({ technology: { name: _name }, pattern: { regex: _regex } }) => + name === _name && + (!regex || regex.toString() === _regex.toString()) + ) === index + ) cache.hits += incrementHits ? 1 : 0 cache.language = cache.language || language @@ -526,6 +538,10 @@ const Driver = { * @param {Object} technologies */ async setIcon(url, technologies = []) { + if (await Driver.isDisabledDomain(url)) { + technologies = [] + } + const dynamicIcon = await getOption('dynamicIcon', false) const badge = await getOption('badge', true) diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index cd01b56e9..f2b58ec07 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -4,7 +4,7 @@ "author": "Wappalyzer", "homepage_url": "https://www.wappalyzer.com/", "description": "Identify web technologies", - "version": "6.7.2", + "version": "6.7.3", "default_locale": "en", "manifest_version": 2, "icons": { diff --git a/src/package.json b/src/package.json index 93fab96a1..6cd619a71 100644 --- a/src/package.json +++ b/src/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com/", - "version": "6.7.2", + "version": "6.7.3", "author": "Wappalyzer", "license": "MIT", "repository": { diff --git a/src/technologies.json b/src/technologies.json index 6510bf35d..a19fbd9fc 100644 --- a/src/technologies.json +++ b/src/technologies.json @@ -16290,7 +16290,7 @@ }, "SAP": { "cats": [ - 22 + 53 ], "headers": { "Server": "SAP NetWeaver Application Server" @@ -23863,4 +23863,4 @@ "website": "https://www.xt-commerce.com" } } -} \ No newline at end of file +}