Index: tools/telemetry/telemetry/core/web_contents.py |
diff --git a/tools/telemetry/telemetry/core/web_contents.py b/tools/telemetry/telemetry/core/web_contents.py |
index 89325814486d824c72c12d79aa41b1fec787118d..4af1c8f14b104a3df6e96807f2eef9ba9f62dc3b 100644 |
--- a/tools/telemetry/telemetry/core/web_contents.py |
+++ b/tools/telemetry/telemetry/core/web_contents.py |
@@ -44,7 +44,24 @@ class WebContents(object): |
# may time out here early. Instead, we want to wait for the full |
# timeout of this method. |
return False |
- util.WaitFor(IsJavaScriptExpressionTrue, timeout) |
+ try: |
+ util.WaitFor(IsJavaScriptExpressionTrue, timeout) |
+ except util.TimeoutException as e: |
+ # Try to make timeouts a little more actionable by dumping |this|. |
+ raise util.TimeoutException(e.message + '\n\nJavaScript |this|:\n' + |
+ self.EvaluateJavaScript(""" |
+ (function() { |
+ var error = ''; |
+ for (name in this) { |
+ try { |
+ error += '\\t' + name + ': ' + this[name] + '\\n'; |
+ } catch (e) { |
+ error += '\\t' + name + ': ???\\n'; |
+ } |
+ } |
+ return error; |
+ })(); |
+ """)) |
def HasReachedQuiescence(self): |
"""Determine whether the page has reached quiescence after loading. |