mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-05-12 11:32:16 -04:00
avoid "Uncaught RangeError: Maximum call stack size exceeded" compiling outlinks
This commit is contained in:
parent
7734399a22
commit
20f9934dd9
2 changed files with 7 additions and 5 deletions
|
@ -301,17 +301,19 @@ class Browser:
|
|||
self._behavior = None
|
||||
|
||||
OUTLINKS_JS = """
|
||||
var compileOutlinks = function(frame) {
|
||||
var __brzl_framesDone = new Set();
|
||||
var __brzl_compileOutlinks = function(frame) {
|
||||
__brzl_framesDone.add(frame);
|
||||
var outlinks = Array.prototype.slice.call(
|
||||
frame.document.querySelectorAll('a[href]'));
|
||||
for (var i = 0; i < frame.frames.length; i++) {
|
||||
if (frame.frames[i]) { // sometimes undefined (why?)
|
||||
outlinks = outlinks.concat(compileOutlinks(frame.frames[i]));
|
||||
if (frame.frames[i] && !__brzl_framesDone.has(frame.frames[i])) {
|
||||
outlinks = outlinks.concat(__brzl_compileOutlinks(frame.frames[i]));
|
||||
}
|
||||
}
|
||||
return outlinks;
|
||||
}
|
||||
compileOutlinks(window).join(' ');
|
||||
__brzl_compileOutlinks(window).join(' ');
|
||||
"""
|
||||
|
||||
def _chain_chrome_messages(self, chain):
|
||||
|
|
2
setup.py
2
setup.py
|
@ -32,7 +32,7 @@ def find_package_data(package):
|
|||
|
||||
setuptools.setup(
|
||||
name='brozzler',
|
||||
version='1.1b5.dev66',
|
||||
version='1.1b5.dev67',
|
||||
description='Distributed web crawling with browsers',
|
||||
url='https://github.com/internetarchive/brozzler',
|
||||
author='Noah Levitt',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue