Bug 878958: Separate out a function for setting reply handlers. r=dcamp

This commit is contained in:
Jim Blandy 2013-06-14 13:14:30 -07:00
parent 8ac0731334
commit eb8478d9ea

View File

@ -548,13 +548,28 @@ DebuggerClient.prototype = {
return true;
}
this._activeRequests.set(request.to, request.onResponse);
this.expectReply(request.to, request.onResponse);
this._transport.send(request.request);
return false;
});
},
/**
* Arrange to hand the next reply from |aActor| to |aHandler|.
*
* DebuggerClient.prototype.request usually takes care of establishing
* the handler for a given request, but in rare cases (well, greetings
* from new root actors, is the only case at the moment) we must be
* prepared for a "reply" that doesn't correspond to any request we sent.
*/
expectReply: function(aActor, aHandler) {
if (this._activeRequests.has(aActor)) {
throw Error("clashing handlers for next reply from " + uneval(aActor));
}
this._activeRequests.set(aActor, aHandler);
},
// Transport hooks.
/**