npm driver fix url filter in recursive mode. allow only urls from the same host (#2317)

main
avasilkov 7 years ago committed by Elbert Alias
parent a0eae8ca04
commit 69f575c83f

@ -146,7 +146,7 @@ class Driver {
.then(() => { .then(() => {
const links = Array.prototype.reduce.call( const links = Array.prototype.reduce.call(
browser.document.getElementsByTagName('a'), (results, link) => { browser.document.getElementsByTagName('a'), (results, link) => {
if ( link.protocol.match(/https?:/) || link.hostname === this.origPageUrl.hostname || extensions.test(link.pathname) ) { if ( link.protocol.match(/https?:/) && link.hostname === this.origPageUrl.hostname && extensions.test(link.pathname) ) {
link.hash = ''; link.hash = '';
results.push(url.parse(link.href)); results.push(url.parse(link.href));