summaryrefslogtreecommitdiff
path: root/crocoite/behavior.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-01-07 10:41:45 +0100
committerLars-Dominik Braun <lars@6xq.net>2019-01-07 10:41:45 +0100
commit3a2fcc69a8eb4237b2862b3e291971d38748f115 (patch)
treef7918781bc17ee4abea810271e1ee50a4b2b3b80 /crocoite/behavior.py
parent73c0647fd35a6ca07bf53a987d6be7ef1055cf43 (diff)
downloadcrocoite-3a2fcc69a8eb4237b2862b3e291971d38748f115.tar.gz
crocoite-3a2fcc69a8eb4237b2862b3e291971d38748f115.tar.bz2
crocoite-3a2fcc69a8eb4237b2862b3e291971d38748f115.zip
Log Chrome’s responses to WARC by default
We may not be able to reproduce every failure, so logging as much as possible is important to figure out what went wrong. Also, in case a bug is uncovered in the future, we can check the logs and possibly fix it with -errata.
Diffstat (limited to 'crocoite/behavior.py')
-rw-r--r--crocoite/behavior.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/crocoite/behavior.py b/crocoite/behavior.py
index 2c94bb8..3ecc92f 100644
--- a/crocoite/behavior.py
+++ b/crocoite/behavior.py
@@ -131,6 +131,8 @@ class JsOnload (Behavior):
# parameter.
# XXX: is there a better way to do this?
result = await tab.Runtime.evaluate (expression=str (self.script))
+ self.logger.debug ('behavior onload inject',
+ uuid='a2da9b78-5648-44c5-bfa8-5c7573e13ad3', result=result)
exception = result.get ('exceptionDetails', None)
result = result['result']
assert result['type'] == 'function', result
@@ -143,6 +145,8 @@ class JsOnload (Behavior):
functionDeclaration='function(options){return new this(options);}',
objectId=constructor,
arguments=[{'value': self.options}])
+ self.logger.debug ('behavior onload start',
+ uuid='6c0605ae-93b3-46b3-b575-ba45790909a7', result=result)
result = result['result']
assert result['type'] == 'object', result
assert result.get ('subtype') != 'error', result
@@ -160,8 +164,7 @@ class JsOnload (Behavior):
self.logger.error ('jsonload onstop failed',
uuid='1786726f-c8ec-4f79-8769-30954d4e32f5',
exception=e.args,
- objectId=self.context,
- context=self.__class__.__name__)
+ objectId=self.context)
return
yield # pragma: no cover
@@ -238,6 +241,8 @@ class DomSnapshot (Behavior):
viewport = await getFormattedViewportMetrics (tab)
dom = await tab.DOM.getDocument (depth=-1, pierce=True)
+ self.logger.debug ('dom snapshot document',
+ uuid='0c720784-8bd1-4fdc-a811-84394d753539', dom=dom)
haveUrls = set ()
for doc in ChromeTreeWalker (dom['root']).split ():
url = URL (doc['documentURL'])