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
parent d92eb17245
commit 5f703484ec

View File

@ -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