Bug 1368650 - Prevent frozen request when actor throws. r=bgrins
When an exception happen, the server replies with {"error":"unknownError"} message,
but without any actorID. It is considered as an unsolicited message.
The original client request that ends up throwing on the server ends up never resolving.
By passing back "actor" with the original actorID being requested, we allow the client to resolve with an error.
MozReview-Commit-ID: Luow4SzqsBP
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -1785,19 +1785,20 @@ DebuggerServerConnection.prototype = {
if (packet.type == "requestTypes") {
ret = { from: actor.actorID, requestTypes: Object.keys(actor.requestTypes) };
} else if (actor.requestTypes && actor.requestTypes[packet.type]) {
// Dispatch the request to the actor.
try {
this.currentPacket = packet;
ret = actor.requestTypes[packet.type].bind(actor)(packet, this);
} catch (e) {
- this.transport.send(this._unknownError(
- "error occurred while processing '" + packet.type,
- e));
+ let errorPacket = this._unknownError(
+ "error occurred while processing '" + packet.type, e);
+ errorPacket.from = packet.to;
+ this.transport.send(errorPacket);
} finally {
this.currentPacket = undefined;
}
} else {
ret = { error: "unrecognizedPacketType",
message: ("Actor " + actor.actorID +
" does not recognize the packet type " +
packet.type) };