| Index: tools/telemetry/telemetry/browser_backend.py
|
| diff --git a/tools/telemetry/telemetry/browser_backend.py b/tools/telemetry/telemetry/browser_backend.py
|
| index b45919dd237c2d5c92e5d358f6f05432512e7a6e..76ce7d1fa371a0fc59926eef16f2ecae1b99397f 100644
|
| --- a/tools/telemetry/telemetry/browser_backend.py
|
| +++ b/tools/telemetry/telemetry/browser_backend.py
|
| @@ -7,6 +7,7 @@ import socket
|
| import json
|
|
|
| from telemetry import browser_gone_exception
|
| +from telemetry import connection_gone_exception
|
| from telemetry import inspector_backend
|
| from telemetry import tab
|
| from telemetry import user_agent
|
| @@ -42,17 +43,7 @@ class BrowserBackend(object):
|
| def IsBrowserUp():
|
| try:
|
| self._ListTabs()
|
| - except socket.error:
|
| - if not self.IsBrowserRunning():
|
| - raise browser_gone_exception.BrowserGoneException()
|
| - return False
|
| - except httplib.BadStatusLine:
|
| - if not self.IsBrowserRunning():
|
| - raise browser_gone_exception.BrowserGoneException()
|
| - return False
|
| - except urllib2.URLError:
|
| - if not self.IsBrowserRunning():
|
| - raise browser_gone_exception.BrowserGoneException()
|
| + except connection_gone_exception.ConnectionGoneException:
|
| return False
|
| else:
|
| return True
|
| @@ -66,17 +57,22 @@ class BrowserBackend(object):
|
| return 'http://localhost:%i/json' % self._port
|
|
|
| def _ListTabs(self, timeout=None):
|
| - req = urllib2.urlopen(self._debugger_url, timeout=timeout)
|
| - data = req.read()
|
| - all_contexts = json.loads(data)
|
| - tabs = [ctx for ctx in all_contexts
|
| - if not ctx['url'].startswith('chrome-extension://')]
|
| - # FIXME(dtu): The remote debugger protocol returns in order of most
|
| - # recently created tab first. In order to convert it to the UI tab
|
| - # order, we just reverse the list, which assumes we can't move tabs.
|
| - # We should guarantee that the remote debugger returns in the UI tab order.
|
| - tabs.reverse()
|
| - return tabs
|
| + try:
|
| + req = urllib2.urlopen(self._debugger_url, timeout=timeout)
|
| + data = req.read()
|
| + all_contexts = json.loads(data)
|
| + tabs = [ctx for ctx in all_contexts
|
| + if not ctx['url'].startswith('chrome-extension://')]
|
| + # FIXME(dtu): The remote debugger protocol returns in order of most
|
| + # recently created tab first. In order to convert it to the UI tab
|
| + # order, we just reverse the list, which assumes we can't move tabs.
|
| + # We should guarantee that the remote debugger returns in UI tab order.
|
| + tabs.reverse()
|
| + return tabs
|
| + except (socket.error, httplib.BadStatusLine, urllib2.URLError):
|
| + if not self.IsBrowserRunning():
|
| + raise browser_gone_exception.BrowserGoneException()
|
| + raise connection_gone_exception.ConnectionGoneException()
|
|
|
| def NewTab(self, timeout=None):
|
| req = urllib2.urlopen(self._debugger_url + '/new', timeout=timeout)
|
|
|