avoid "Uncaught TypeError: Cannot read property 'querySelectorAll' of undefined" from outlinks script

This commit is contained in:
Noah Levitt 2016-08-25 13:10:30 -07:00
parent ed7e01210d
commit 1c5c9417d2
2 changed files with 8 additions and 6 deletions

View file

@ -304,6 +304,7 @@ class Browser:
var __brzl_framesDone = new Set();
var __brzl_compileOutlinks = function(frame) {
__brzl_framesDone.add(frame);
if (frame && frame.document) {
var outlinks = Array.prototype.slice.call(
frame.document.querySelectorAll('a[href]'));
for (var i = 0; i < frame.frames.length; i++) {
@ -311,6 +312,7 @@ var __brzl_compileOutlinks = function(frame) {
outlinks = outlinks.concat(__brzl_compileOutlinks(frame.frames[i]));
}
}
}
return outlinks;
}
__brzl_compileOutlinks(window).join(' ');

View file

@ -32,7 +32,7 @@ def find_package_data(package):
setuptools.setup(
name='brozzler',
version='1.1b6.dev77',
version='1.1b6.dev78',
description='Distributed web crawling with browsers',
url='https://github.com/internetarchive/brozzler',
author='Noah Levitt',