Bug 793947 - Race condition in dbg-server.js breaks Marionette; r=msucan

This commit is contained in:
Panos Astithas 2012-09-27 12:31:49 +01:00
Родитель c4e22ba695
Коммит 8233647168
2 изменённых файлов: 4 добавлений и 31 удалений

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

@ -316,12 +316,10 @@ var DebuggerServer = {
},
/**
* Remove the connection from the debugging server and shut down the server
* if no other connections are open.
* Remove the connection from the debugging server.
*/
_connectionClosed: function DH_connectionClosed(aConnection) {
delete this._connections[aConnection.prefix];
this.destroy();
}
};

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

@ -59,35 +59,10 @@ function test_socket_conn()
function test_socket_shutdown()
{
let count = 0;
wait_for_server_shutdown(count);
}
function wait_for_server_shutdown(aCount)
{
do_timeout(100, function() {
dump("count: "+aCount+" ");
if (++aCount > 20) {
do_throw("Timed out waiting for the server to shut down.");
return;
}
if (DebuggerServer.initialized) {
wait_for_server_shutdown(aCount);
return;
}
real_test_socket_shutdown(aCount);
});
}
function real_test_socket_shutdown()
{
// After the last conection was closed, the server must be initialized again.
// Allow incoming connections.
DebuggerServer.init(function () true);
DebuggerServer.addActors("resource://test/testactors.js");
do_check_eq(DebuggerServer._socketConnections, 1);
do_check_true(DebuggerServer.closeListener());
do_check_eq(DebuggerServer._socketConnections, 0);
// Make sure closing a non-started listener does nothing.
// Make sure closing the listener twice does nothing.
do_check_false(DebuggerServer.closeListener());
do_check_eq(DebuggerServer._socketConnections, 0);