Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: tools/telemetry/telemetry/core/web_contents.py

Issue 296403008: [Telemetry] When JS times out, output everything in |this|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698