Fix uncaught promise error

main
Elbert Alias 4 years ago
parent 892fe1ac14
commit 4e8cf66677

@ -196,10 +196,11 @@ class Site {
} }
timeout() { timeout() {
return new Promise(() => return new Promise((resolve, reject) =>
setTimeout(() => { setTimeout(
throw new Error('The website took too long to respond') () => reject(new Error('The website took too long to respond')),
}, this.options.maxWait) this.options.maxWait
)
) )
} }
@ -300,7 +301,7 @@ class Site {
try { try {
await Promise.race([ await Promise.race([
this.timeout(), await this.timeout(),
page.goto(url.href, { waitUntil: 'domcontentloaded' }) page.goto(url.href, { waitUntil: 'domcontentloaded' })
]) ])
@ -308,8 +309,8 @@ class Site {
// Links // Links
const links = await Promise.race([ const links = await Promise.race([
this.timeout(), await this.timeout(),
await ( (
await page.evaluateHandle(() => await 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 }) => ({
@ -327,8 +328,8 @@ class Site {
// Script tags // Script tags
const scripts = await Promise.race([ const scripts = await Promise.race([
this.timeout(), await this.timeout(),
await ( (
await page.evaluateHandle(() => await page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('script')) Array.from(document.getElementsByTagName('script'))
.map(({ src }) => src) .map(({ src }) => src)
@ -339,8 +340,8 @@ class Site {
// Meta tags // Meta tags
const meta = await Promise.race([ const meta = await Promise.race([
this.timeout(), await this.timeout(),
await ( (
await page.evaluateHandle(() => await page.evaluateHandle(() =>
Array.from(document.querySelectorAll('meta')).reduce( Array.from(document.querySelectorAll('meta')).reduce(
(metas, meta) => { (metas, meta) => {
@ -361,8 +362,8 @@ class Site {
// JavaScript // JavaScript
const js = await Promise.race([ const js = await Promise.race([
this.timeout(), await this.timeout(),
await page.evaluate( page.evaluate(
(technologies) => { (technologies) => {
return technologies.reduce((technologies, { name, chains }) => { return technologies.reduce((technologies, { name, chains }) => {
chains.forEach((chain) => { chains.forEach((chain) => {
@ -441,8 +442,8 @@ class Site {
if (!this.language) { if (!this.language) {
this.language = await Promise.race([ this.language = await Promise.race([
this.timeout(), await this.timeout(),
await ( (
await page.evaluateHandle( await page.evaluateHandle(
() => () =>
document.documentElement.getAttribute('lang') || document.documentElement.getAttribute('lang') ||

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

@ -131,6 +131,7 @@ const Popup = {
for (const el of document.querySelectorAll('.footer__switch')) { for (const el of document.querySelectorAll('.footer__switch')) {
el.classList.add('footer__switch--hidden') el.classList.add('footer__switch--hidden')
} }
document.querySelector('.alerts').classList.add('alerts--hidden') document.querySelector('.alerts').classList.add('alerts--hidden')
} }
} }

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

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

Loading…
Cancel
Save