diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 20:22:32 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 20:22:32 +0000 |
commit | 30b9d7672c34d5a2a2f31914af3de478ada12d3e (patch) | |
tree | 8bc25d1d03788e4f8bf08163685949c294444e3c /tools/telemetry | |
parent | de9711e18cba27a05df94ff6d486eee63b9689c9 (diff) | |
download | chromium_src-30b9d7672c34d5a2a2f31914af3de478ada12d3e.zip chromium_src-30b9d7672c34d5a2a2f31914af3de478ada12d3e.tar.gz chromium_src-30b9d7672c34d5a2a2f31914af3de478ada12d3e.tar.bz2 |
[Telemetry] Fix race in script_to_evaluate_on_commit.
Page.disable causes all scripts-to-evaluate-on-load to be cleared. There was a
race where we would call Page.disable prior to the script-to-evaluate-on-load
being executed. That would clear it before it got a chance to run.
This patch fixes the race by:
1. Don't count Page.frameNavigated messages for subframes. In some cases we
were getting a framNavigated for a subframe prior to the parent frame. This
receipt is the only thing blocking the call to Page.disable. So we could do
it too early.
2. Make addScriptToEvaluateOnLoad a synchronous call. This ensures the script
is properly registered before navigating. Also add an assertion that verifies
this is the only script to evaluate on load (meaning that Page.disable
correctly cleared the previous scripts).
BUG=None
TEST=tools/perf/run_multipage_benchmarks --browser=release page_cycler tools/perf/page_sets/typical_25.json --page-filter="ticketmaster|ign"
NOTRY=True
Review URL: https://chromiumcodereview.appspot.com/14472018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/telemetry')
-rw-r--r-- | tools/telemetry/telemetry/core/chrome/inspector_page.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/telemetry/telemetry/core/chrome/inspector_page.py b/tools/telemetry/telemetry/core/chrome/inspector_page.py index 4253c28..750143a 100644 --- a/tools/telemetry/telemetry/core/chrome/inspector_page.py +++ b/tools/telemetry/telemetry/core/chrome/inspector_page.py @@ -19,7 +19,8 @@ class InspectorPage(object): logging.debug('Notification: %s', json.dumps(msg, indent=2)) if msg['method'] == 'Page.frameNavigated' and self._navigation_pending: url = msg['params']['frame']['url'] - if not url == 'chrome://newtab/' and not url == 'about:blank': + if (not url == 'chrome://newtab/' and not url == 'about:blank' + and not 'parentId' in msg['params']['frame']): # Marks the navigation as complete and unblocks the # PerformActionAndWaitForNavigate call. self._navigation_pending = False @@ -78,7 +79,9 @@ class InspectorPage(object): 'scriptSource': script_to_evaluate_on_commit, } } - self._inspector_backend.SendAndIgnoreResponse(request) + res = self._inspector_backend.SyncRequest(request) + assert res['result']['identifier'] == '1', ('Unexpected response from ' + 'addScriptToEvaluateOnLoad') # 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. |