Bug 797639 - Part 3: Fix Marionette client / server loading and parsing. r=jgriffin

This commit is contained in:
J. Ryan Stinnett 2014-05-14 14:30:02 -05:00
Родитель 19db5518de
Коммит d00a33574f
5 изменённых файлов: 8 добавлений и 5 удалений

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

@ -538,7 +538,7 @@ window.addEventListener('mozbrowserloadend', function loaded(aEvent) {
sock.connect(('localhost', self.marionette_port))
data = sock.recv(16)
sock.close()
if '"from"' in data:
if ':' in data:
return True
except:
import traceback

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

@ -586,7 +586,7 @@ class Marionette(object):
sock.connect((self.host, self.port))
data = sock.recv(16)
sock.close()
if '"from"' in data:
if ':' in data:
time.sleep(5)
return True
except socket.error:

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

@ -6,6 +6,7 @@ this.CC = Components.Constructor;
this.Cc = Components.classes;
this.Ci = Components.interfaces;
this.Cu = Components.utils;
this.Cr = Components.results;
const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1";
const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}");

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

@ -38,7 +38,7 @@ let appName = Services.appinfo.name;
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
this.DevToolsUtils = DevToolsUtils;
loader.loadSubScript("resource://gre/modules/devtools/server/transport.js");
loader.loadSubScript("resource://gre/modules/devtools/transport/transport.js");
let bypassOffline = false;
let qemu = "0";
@ -202,7 +202,7 @@ MarionetteServerConnection.prototype = {
*/
sendAsync: function MDA_sendAsync(name, values, commandId, ignoreFailure) {
let success = true;
if (values instanceof Object && commandId) {
if (commandId) {
values.command_id = commandId;
}
if (this.curBrowser.frameManager.currentRemoteFrame !== null) {

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

@ -45,11 +45,13 @@ class MarionetteTransport(object):
"""
assert(self.sock)
response = self.sock.recv(10)
initial_size = len(response)
sep = response.find(':')
length = response[0:sep]
if length != '':
response = response[sep + 1:]
response += self._recv_n_bytes(int(length) + 1 + len(length) - 10)
remaining_size = int(length) + 1 + len(length) - initial_size
response += self._recv_n_bytes(remaining_size)
return json.loads(response)
else:
raise IOError(self.connection_lost_msg)