Replace promise with callback in browser.wait

main
Elbert Alias 8 years ago
parent 7661c76029
commit e4cfe4599f

@ -22,11 +22,12 @@ class Driver {
}, options || {}); }, options || {});
this.options.debug = Boolean(this.options.debug); this.options.debug = Boolean(this.options.debug);
this.options.recursive = Boolean(this.options.recursive);
this.options.delay = this.options.recursive ? parseInt(this.options.delay, 10) : 0; this.options.delay = this.options.recursive ? parseInt(this.options.delay, 10) : 0;
this.options.maxDepth = parseInt(this.options.maxDepth, 10); this.options.maxDepth = parseInt(this.options.maxDepth, 10);
this.options.maxUrls = parseInt(this.options.maxUrls, 10); this.options.maxUrls = parseInt(this.options.maxUrls, 10);
this.options.maxWait = parseInt(this.options.maxWait, 10); this.options.maxWait = parseInt(this.options.maxWait, 10);
this.options.recursive = Boolean(this.options.recursive);
this.options.requestTimeout = parseInt(this.options.requestTimeout, 10);
this.origPageUrl = url.parse(pageUrl); this.origPageUrl = url.parse(pageUrl);
this.analyzedPageUrls = []; this.analyzedPageUrls = [];
@ -104,7 +105,7 @@ class Driver {
const browser = new Browser({ const browser = new Browser({
silent: true, silent: true,
userAgent: this.options.userAgent, userAgent: this.options.userAgent,
waitDuration: this.options.maxWait + 'ms', waitDuration: this.options.maxWait,
}); });
this.sleep(this.options.delay * index) this.sleep(this.options.delay * index)
@ -120,9 +121,7 @@ class Driver {
return resolve(); return resolve();
} }
browser.wait(this.options.maxWait) browser.wait(this.options.maxWait, () => {
.catch(error => this.wappalyzer.log(error.message, 'browser', 'error'))
.finally(() => {
this.timer('browser.wait end'); this.timer('browser.wait end');
const headers = this.getHeaders(browser); const headers = this.getHeaders(browser);