From 4e8cf66677f361add360d2d7004c5532472e9763 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Sun, 2 Aug 2020 09:24:33 +1000 Subject: [PATCH] Fix uncaught promise error --- src/drivers/npm/driver.js | 31 +++++++++++++------------- src/drivers/npm/package.json | 4 ++-- src/drivers/webextension/js/popup.js | 1 + src/drivers/webextension/manifest.json | 2 +- src/package.json | 4 ++-- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index ada4d99ac..d0e17f904 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -196,10 +196,11 @@ class Site { } timeout() { - return new Promise(() => - setTimeout(() => { - throw new Error('The website took too long to respond') - }, this.options.maxWait) + return new Promise((resolve, reject) => + setTimeout( + () => reject(new Error('The website took too long to respond')), + this.options.maxWait + ) ) } @@ -300,7 +301,7 @@ class Site { try { await Promise.race([ - this.timeout(), + await this.timeout(), page.goto(url.href, { waitUntil: 'domcontentloaded' }) ]) @@ -308,8 +309,8 @@ class Site { // Links const links = await Promise.race([ - this.timeout(), - await ( + await this.timeout(), + ( await page.evaluateHandle(() => Array.from(document.getElementsByTagName('a')).map( ({ hash, hostname, href, pathname, protocol, rel }) => ({ @@ -327,8 +328,8 @@ class Site { // Script tags const scripts = await Promise.race([ - this.timeout(), - await ( + await this.timeout(), + ( await page.evaluateHandle(() => Array.from(document.getElementsByTagName('script')) .map(({ src }) => src) @@ -339,8 +340,8 @@ class Site { // Meta tags const meta = await Promise.race([ - this.timeout(), - await ( + await this.timeout(), + ( await page.evaluateHandle(() => Array.from(document.querySelectorAll('meta')).reduce( (metas, meta) => { @@ -361,8 +362,8 @@ class Site { // JavaScript const js = await Promise.race([ - this.timeout(), - await page.evaluate( + await this.timeout(), + page.evaluate( (technologies) => { return technologies.reduce((technologies, { name, chains }) => { chains.forEach((chain) => { @@ -441,8 +442,8 @@ class Site { if (!this.language) { this.language = await Promise.race([ - this.timeout(), - await ( + await this.timeout(), + ( await page.evaluateHandle( () => document.documentElement.getAttribute('lang') || diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index 337506d61..31b4e0152 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.2.0", + "version": "6.2.2", "author": "Wappalyzer", "license": "MIT", "repository": { @@ -38,4 +38,4 @@ "languagedetect": "^2.0.0", "puppeteer": "^2.0.0" } -} \ No newline at end of file +} diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index e7e20bc5c..f63b7994c 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -131,6 +131,7 @@ const Popup = { for (const el of document.querySelectorAll('.footer__switch')) { el.classList.add('footer__switch--hidden') } + document.querySelector('.alerts').classList.add('alerts--hidden') } } diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index e7e169a8a..b08fec31e 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.2.0", + "version": "6.2.1", "default_locale": "en", "manifest_version": 2, "icons": { diff --git a/src/package.json b/src/package.json index 1f51621fc..336bab5fc 100644 --- a/src/package.json +++ b/src/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com", - "version": "6.2.0", + "version": "6.2.2", "author": "Wappalyzer", "license": "MIT", "repository": { @@ -27,4 +27,4 @@ "files": [ "wappalyzer.js" ] -} \ No newline at end of file +}