summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 22:33:14 +0000
committertonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 22:33:14 +0000
commitae5223d9f48dbdf2267b83ed98404798ec6e8633 (patch)
tree0b4f37f084809cfe319525faa031abe928debe46 /tools
parentd5825e11bd7457e7c48bc364865a7f1b33ac9fb2 (diff)
downloadchromium_src-ae5223d9f48dbdf2267b83ed98404798ec6e8633.zip
chromium_src-ae5223d9f48dbdf2267b83ed98404798ec6e8633.tar.gz
chromium_src-ae5223d9f48dbdf2267b83ed98404798ec6e8633.tar.bz2
[Telemetry] Fix race in tab.Navigate's script_to_evaluate_on_commit.
I believe this is what was causing the page cyclers to hang on the bots. We must add the script to evaluate on load prior to performing the navigation. If we add it after, it is racy. The reason it wasn't like this before is that Page.addScriptToEvaluateOnLoad didn't work on cross-renderer navigations. But that problem is being fixed by https://codereview.chromium.org/13949006/ The current file-based page cyclers don't do cross renderer navigations, so will be fine even without the above fix. However, the above fix will be necessary for the new WPR-based page sets. BUG=None TEST=page set based page cyclers on linux NOTRY=True Review URL: https://codereview.chromium.org/13926007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/telemetry/telemetry/core/chrome/inspector_page.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/telemetry/telemetry/core/chrome/inspector_page.py b/tools/telemetry/telemetry/core/chrome/inspector_page.py
index d5eac72..4253c28 100644
--- a/tools/telemetry/telemetry/core/chrome/inspector_page.py
+++ b/tools/telemetry/telemetry/core/chrome/inspector_page.py
@@ -71,6 +71,14 @@ class InspectorPage(object):
"""
def DoNavigate():
+ if script_to_evaluate_on_commit:
+ request = {
+ 'method': 'Page.addScriptToEvaluateOnLoad',
+ 'params': {
+ 'scriptSource': script_to_evaluate_on_commit,
+ }
+ }
+ self._inspector_backend.SendAndIgnoreResponse(request)
# Navigate the page. However, there seems to be a bug in chrome devtools
# protocol where the request id for this event gets held on the browser
# side pretty much indefinitely.
@@ -84,14 +92,6 @@ class InspectorPage(object):
}
}
self._inspector_backend.SendAndIgnoreResponse(request)
- if script_to_evaluate_on_commit:
- request = {
- 'method': 'Page.addScriptToEvaluateOnLoad',
- 'params': {
- 'scriptSource': script_to_evaluate_on_commit,
- }
- }
- self._inspector_backend.SendAndIgnoreResponse(request)
self.PerformActionAndWaitForNavigate(DoNavigate, timeout)
def GetCookieByName(self, name, timeout=60):