| 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 1837a301ca728e74ca6f8e4d79be33d48c53d4e2..15c87e89f9ee173577f2b02cf1339b3de0c5979f 100644
|
| --- a/tools/telemetry/telemetry/core/web_contents.py
|
| +++ b/tools/telemetry/telemetry/core/web_contents.py
|
| @@ -73,7 +73,8 @@ class WebContents(object):
|
|
|
| If the expression failed to evaluate, EvaluateException will be raised.
|
| """
|
| - self._inspector_backend.ExecuteJavaScript(expr, timeout)
|
| + return self.ExecuteJavaScriptInContext(
|
| + expr, context_id=None, timeout=timeout)
|
|
|
| def EvaluateJavaScript(self, expr, timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
|
| """Evalutes expr in JavaScript and returns the JSONized result.
|
| @@ -87,7 +88,24 @@ class WebContents(object):
|
| If the result of the evaluation cannot be JSONized, then an
|
| EvaluationException will be raised.
|
| """
|
| - return self._inspector_backend.EvaluateJavaScript(expr, timeout)
|
| + return self.EvaluateJavaScriptInContext(
|
| + expr, context_id=None, timeout=timeout)
|
| +
|
| + def ExecuteJavaScriptInContext(self, expr, context_id,
|
| + timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
|
| + """Similar to ExecuteJavaScript, except context_id can refer to an iframe.
|
| + The main page has context_id=1, the first iframe context_id=2, etc.
|
| + """
|
| + return self._inspector_backend.ExecuteJavaScript(
|
| + expr, context_id=context_id, timeout=timeout)
|
| +
|
| + def EvaluateJavaScriptInContext(self, expr, context_id,
|
| + timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
|
| + """Similar to ExecuteJavaScript, except context_id can refer to an iframe.
|
| + The main page has context_id=1, the first iframe context_id=2, etc.
|
| + """
|
| + return self._inspector_backend.EvaluateJavaScript(
|
| + expr, context_id=context_id, timeout=timeout)
|
|
|
| @property
|
| def message_output_stream(self):
|
|
|