| Index: trunk/src/tools/telemetry/telemetry/core/backends/chrome/inspector_runtime.py
|
| ===================================================================
|
| --- trunk/src/tools/telemetry/telemetry/core/backends/chrome/inspector_runtime.py (revision 255714)
|
| +++ trunk/src/tools/telemetry/telemetry/core/backends/chrome/inspector_runtime.py (working copy)
|
| @@ -10,7 +10,6 @@
|
| 'Runtime',
|
| self._OnNotification,
|
| self._OnClose)
|
| - self._contexts_enabled = False
|
|
|
| def _OnNotification(self, msg):
|
| pass
|
| @@ -18,11 +17,25 @@
|
| def _OnClose(self):
|
| pass
|
|
|
| - def Execute(self, expr, context_id, timeout):
|
| - self.Evaluate(expr + '; 0;', context_id, timeout)
|
| + def Execute(self, expr, timeout=60):
|
| + """Executes expr in javascript. Does not return the result.
|
|
|
| - def Evaluate(self, expr, context_id, timeout):
|
| - self._EnableAllContexts(context_id)
|
| + If the expression failed to evaluate, EvaluateException will be raised.
|
| + """
|
| + self.Evaluate(expr + '; 0;', timeout)
|
| +
|
| + def Evaluate(self, expr, timeout=60):
|
| + """Evalutes expr in javascript and returns the JSONized result.
|
| +
|
| + Consider using Execute for cases where the result of the expression is not
|
| + needed.
|
| +
|
| + If evaluation throws in javascript, a python EvaluateException will
|
| + be raised.
|
| +
|
| + If the result of the evaluation cannot be JSONized, then an
|
| + EvaluationException will be raised.
|
| + """
|
| request = {
|
| 'method': 'Runtime.evaluate',
|
| 'params': {
|
| @@ -30,8 +43,6 @@
|
| 'returnByValue': True
|
| }
|
| }
|
| - if context_id is not None:
|
| - request['params']['contextId'] = context_id
|
| res = self._inspector_backend.SyncRequest(request, timeout)
|
| if 'error' in res:
|
| raise exceptions.EvaluateException(res['error']['message'])
|
| @@ -43,10 +54,3 @@
|
| if res['result']['result']['type'] == 'undefined':
|
| return None
|
| return res['result']['result']['value']
|
| -
|
| - def _EnableAllContexts(self, context_id):
|
| - """Allow access to iframes as necessary."""
|
| - if context_id is not None and not self._contexts_enabled:
|
| - self._inspector_backend.SyncRequest({'method': 'Runtime.enable'},
|
| - timeout=30)
|
| - self._contexts_enabled = True
|
|
|