Fix timeouts in NPM driver

main
Elbert Alias 4 years ago
parent 279345c5d4
commit 476083fb30

@ -345,10 +345,10 @@ class Site {
await sleep(1000) await sleep(1000)
// Links // Links
const links = await Promise.race([ const links = await (
this.timeout(), await Promise.race([
( this.timeout(),
await page.evaluateHandle(() => page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('a')).map( Array.from(document.getElementsByTagName('a')).map(
({ hash, hostname, href, pathname, protocol, rel }) => ({ ({ hash, hostname, href, pathname, protocol, rel }) => ({
hash, hash,
@ -359,15 +359,15 @@ class Site {
rel, rel,
}) })
) )
) ),
).jsonValue(), ])
]) ).jsonValue()
// CSS // CSS
const css = await Promise.race([ const css = await (
this.timeout(), await Promise.race([
( this.timeout(),
await page.evaluateHandle((maxRows) => { page.evaluateHandle((maxRows) => {
const css = [] const css = []
try { try {
@ -389,27 +389,27 @@ class Site {
} }
return css.join('\n') return css.join('\n')
}, this.options.htmlMaxRows) }, this.options.htmlMaxRows),
).jsonValue(), ])
]) ).jsonValue()
// Script tags // Script tags
const scripts = await Promise.race([ const scripts = await (
this.timeout(), await Promise.race([
( this.timeout(),
await page.evaluateHandle(() => page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('script')) Array.from(document.getElementsByTagName('script'))
.map(({ src }) => src) .map(({ src }) => src)
.filter((src) => src) .filter((src) => src)
) ),
).jsonValue(), ])
]) ).jsonValue()
// Meta tags // Meta tags
const meta = await Promise.race([ const meta = await (
this.timeout(), await Promise.race([
( this.timeout(),
await page.evaluateHandle(() => page.evaluateHandle(() =>
Array.from(document.querySelectorAll('meta')).reduce( Array.from(document.querySelectorAll('meta')).reduce(
(metas, meta) => { (metas, meta) => {
const key = const key =
@ -423,9 +423,9 @@ class Site {
}, },
{} {}
) )
) ),
).jsonValue(), ])
]) ).jsonValue()
// JavaScript // JavaScript
const js = await Promise.race([ const js = await Promise.race([

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

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

Loading…
Cancel
Save