Bug 1049835 - Don't require actor clients to have a detach method. r=ochameau

This commit is contained in:
Jan Keromnes 2014-08-18 06:14:00 -04:00
parent 9894feff1b
commit 931b838202
3 changed files with 6 additions and 8 deletions

View File

@ -295,7 +295,6 @@ function MonitorClient(client, form) {
MonitorClient.prototype.destroy = function () { MonitorClient.prototype.destroy = function () {
this.client.unregisterClient(this); this.client.unregisterClient(this);
} }
MonitorClient.prototype.detach = function () {}
MonitorClient.prototype.start = function () { MonitorClient.prototype.start = function () {
this.client.request({ this.client.request({
to: this.actor, to: this.actor,

View File

@ -420,7 +420,11 @@ DebuggerClient.prototype = {
this._transport = null; this._transport = null;
return; return;
} }
client.detach(detachClients); if (client.detach) {
client.detach(detachClients);
return;
}
detachClients();
}; };
detachClients(); detachClients();
}, },
@ -1008,13 +1012,9 @@ DebuggerClient.prototype = {
} }
if (client.events.length > 0 && typeof(client.emit) != "function") { if (client.events.length > 0 && typeof(client.emit) != "function") {
throw new Error("DebuggerServer.registerClient expects " + throw new Error("DebuggerServer.registerClient expects " +
"client instances with non-empty `events` array to" + "a client instance with non-empty `events` array to" +
"have an `emit` function."); "have an `emit` function.");
} }
if (typeof(client.detach) != "function") {
throw new Error("DebuggerServer.registerClient expects " +
"a client instance with a `detach` function.");
}
if (this._clients.has(actorID)) { if (this._clients.has(actorID)) {
throw new Error("DebuggerServer.registerClient already registered " + throw new Error("DebuggerServer.registerClient already registered " +
"a client for this actor."); "a client for this actor.");

View File

@ -27,7 +27,6 @@ function run_test()
MonitorClient.prototype.destroy = function () { MonitorClient.prototype.destroy = function () {
client.unregisterClient(this); client.unregisterClient(this);
} }
MonitorClient.prototype.detach = function () {}
MonitorClient.prototype.start = function (callback) { MonitorClient.prototype.start = function (callback) {
this.client.request({ this.client.request({
to: this.actor, to: this.actor,