mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +00:00
Bug 878958: Separate out a function for setting reply handlers. r=dcamp
This commit is contained in:
parent
8ac0731334
commit
eb8478d9ea
@ -548,13 +548,28 @@ DebuggerClient.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._activeRequests.set(request.to, request.onResponse);
|
this.expectReply(request.to, request.onResponse);
|
||||||
this._transport.send(request.request);
|
this._transport.send(request.request);
|
||||||
|
|
||||||
return false;
|
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.
|
// Transport hooks.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user