handle "undefined" in list of frames when extracting outlinks (fixes ARI-4988)

This commit is contained in:
Noah Levitt 2016-06-28 12:23:32 -05:00
parent 0bd687abde
commit 772bcf0df6
2 changed files with 4 additions and 2 deletions

View file

@ -290,8 +290,10 @@ var compileOutlinks = function(frame) {
var outlinks = Array.prototype.slice.call( var outlinks = Array.prototype.slice.call(
frame.document.querySelectorAll('a[href]')); frame.document.querySelectorAll('a[href]'));
for (var i = 0; i < frame.frames.length; i++) { for (var i = 0; i < frame.frames.length; i++) {
if (frame.frames[i]) { // sometimes undefined (why?)
outlinks = outlinks.concat(compileOutlinks(frame.frames[i])); outlinks = outlinks.concat(compileOutlinks(frame.frames[i]));
} }
}
return outlinks; return outlinks;
} }
compileOutlinks(window).join(' '); compileOutlinks(window).join(' ');

View file

@ -21,7 +21,7 @@ import setuptools
setuptools.setup( setuptools.setup(
name='brozzler', name='brozzler',
version='1.1.dev25', version='1.1.dev26',
description='Distributed web crawling with browsers', description='Distributed web crawling with browsers',
url='https://github.com/internetarchive/brozzler', url='https://github.com/internetarchive/brozzler',
author='Noah Levitt', author='Noah Levitt',