From 476083fb30e0b416ee5b34ab41ade26b96b9ea53 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Tue, 8 Sep 2020 17:31:46 +1000 Subject: [PATCH] Fix timeouts in NPM driver --- src/drivers/npm/driver.js | 56 ++++++++++++++++++------------------ src/drivers/npm/package.json | 2 +- src/package.json | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 62b984276..a68696437 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -345,10 +345,10 @@ class Site { await sleep(1000) // Links - const links = await Promise.race([ - this.timeout(), - ( - await page.evaluateHandle(() => + const links = await ( + await Promise.race([ + this.timeout(), + page.evaluateHandle(() => Array.from(document.getElementsByTagName('a')).map( ({ hash, hostname, href, pathname, protocol, rel }) => ({ hash, @@ -359,15 +359,15 @@ class Site { rel, }) ) - ) - ).jsonValue(), - ]) + ), + ]) + ).jsonValue() // CSS - const css = await Promise.race([ - this.timeout(), - ( - await page.evaluateHandle((maxRows) => { + const css = await ( + await Promise.race([ + this.timeout(), + page.evaluateHandle((maxRows) => { const css = [] try { @@ -389,27 +389,27 @@ class Site { } return css.join('\n') - }, this.options.htmlMaxRows) - ).jsonValue(), - ]) + }, this.options.htmlMaxRows), + ]) + ).jsonValue() // Script tags - const scripts = await Promise.race([ - this.timeout(), - ( - await page.evaluateHandle(() => + const scripts = await ( + await Promise.race([ + this.timeout(), + page.evaluateHandle(() => Array.from(document.getElementsByTagName('script')) .map(({ src }) => src) .filter((src) => src) - ) - ).jsonValue(), - ]) + ), + ]) + ).jsonValue() // Meta tags - const meta = await Promise.race([ - this.timeout(), - ( - await page.evaluateHandle(() => + const meta = await ( + await Promise.race([ + this.timeout(), + page.evaluateHandle(() => Array.from(document.querySelectorAll('meta')).reduce( (metas, meta) => { const key = @@ -423,9 +423,9 @@ class Site { }, {} ) - ) - ).jsonValue(), - ]) + ), + ]) + ).jsonValue() // JavaScript const js = await Promise.race([ diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index 9864625e9..59fb46b9d 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.3.1", + "version": "6.3.2", "author": "Wappalyzer", "license": "MIT", "repository": { diff --git a/src/package.json b/src/package.json index 3c9cbb6f8..057c0978c 100644 --- a/src/package.json +++ b/src/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com/", - "version": "6.3.1", + "version": "6.3.2", "author": "Wappalyzer", "license": "MIT", "repository": {