Bug 757174: Better error message when marionette can no longer communicate with Gecko. DONTBUILD because NPOTB r=jgriffin

This commit is contained in:
David Burns 2012-05-24 05:07:53 -07:00
Родитель 0d4aad123b
Коммит 65873d1686
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -5,6 +5,8 @@
import json
import socket
from errors import MarionetteException
class MarionetteClient(object):
""" The Marionette socket client. This speaks the same protocol
as the remote debugger inside Gecko, in which messages are
@ -42,9 +44,12 @@ class MarionetteClient(object):
response = self.sock.recv(10)
sep = response.find(':')
length = response[0:sep]
response = response[sep + 1:]
response += self._recv_n_bytes(int(length) + 1 + len(length) - 10)
return json.loads(response)
if length != '':
response = response[sep + 1:]
response += self._recv_n_bytes(int(length) + 1 + len(length) - 10)
return json.loads(response)
else:
raise MarionetteException("Could not successfully complete transport of message to Gecko, socket closed?")
def connect(self):
""" Connect to the server and process the hello message we expect