зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1090594 - Part 2: Fix indentation in DebuggerClient.prototype.onPacket. r=ejpbruel
This commit is contained in:
Родитель
64d955e012
Коммит
74b120aef6
|
@ -859,71 +859,71 @@ DebuggerClient.prototype = {
|
||||||
* The incoming packet.
|
* The incoming packet.
|
||||||
*/
|
*/
|
||||||
onPacket: function (aPacket) {
|
onPacket: function (aPacket) {
|
||||||
if (!aPacket.from) {
|
if (!aPacket.from) {
|
||||||
DevToolsUtils.reportException(
|
DevToolsUtils.reportException(
|
||||||
"onPacket",
|
"onPacket",
|
||||||
new Error("Server did not specify an actor, dropping packet: " +
|
new Error("Server did not specify an actor, dropping packet: " +
|
||||||
JSON.stringify(aPacket)));
|
JSON.stringify(aPacket)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have a registered Front for this actor, let it handle the packet
|
||||||
|
// and skip all the rest of this unpleasantness.
|
||||||
|
let front = this.getActor(aPacket.from);
|
||||||
|
if (front) {
|
||||||
|
front.onPacket(aPacket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._clients.has(aPacket.from) && aPacket.type) {
|
||||||
|
let client = this._clients.get(aPacket.from);
|
||||||
|
let type = aPacket.type;
|
||||||
|
if (client.events.indexOf(type) != -1) {
|
||||||
|
client.emit(type, aPacket);
|
||||||
|
// we ignore the rest, as the client is expected to handle this packet.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we have a registered Front for this actor, let it handle the packet
|
let activeRequest;
|
||||||
// and skip all the rest of this unpleasantness.
|
// See if we have a handler function waiting for a reply from this
|
||||||
let front = this.getActor(aPacket.from);
|
// actor. (Don't count unsolicited notifications or pauses as
|
||||||
if (front) {
|
// replies.)
|
||||||
front.onPacket(aPacket);
|
if (this._activeRequests.has(aPacket.from) &&
|
||||||
return;
|
!(aPacket.type in UnsolicitedNotifications) &&
|
||||||
}
|
!(aPacket.type == ThreadStateTypes.paused &&
|
||||||
|
aPacket.why.type in UnsolicitedPauses)) {
|
||||||
|
activeRequest = this._activeRequests.get(aPacket.from);
|
||||||
|
this._activeRequests.delete(aPacket.from);
|
||||||
|
}
|
||||||
|
|
||||||
if (this._clients.has(aPacket.from) && aPacket.type) {
|
// Packets that indicate thread state changes get special treatment.
|
||||||
let client = this._clients.get(aPacket.from);
|
if (aPacket.type in ThreadStateTypes &&
|
||||||
let type = aPacket.type;
|
this._clients.has(aPacket.from) &&
|
||||||
if (client.events.indexOf(type) != -1) {
|
typeof this._clients.get(aPacket.from)._onThreadState == "function") {
|
||||||
client.emit(type, aPacket);
|
this._clients.get(aPacket.from)._onThreadState(aPacket);
|
||||||
// we ignore the rest, as the client is expected to handle this packet.
|
}
|
||||||
return;
|
// On navigation the server resumes, so the client must resume as well.
|
||||||
}
|
// We achieve that by generating a fake resumption packet that triggers
|
||||||
}
|
// the client's thread state change listeners.
|
||||||
|
if (aPacket.type == UnsolicitedNotifications.tabNavigated &&
|
||||||
|
this._clients.has(aPacket.from) &&
|
||||||
|
this._clients.get(aPacket.from).thread) {
|
||||||
|
let thread = this._clients.get(aPacket.from).thread;
|
||||||
|
let resumption = { from: thread._actor, type: "resumed" };
|
||||||
|
thread._onThreadState(resumption);
|
||||||
|
}
|
||||||
|
// Only try to notify listeners on events, not responses to requests
|
||||||
|
// that lack a packet type.
|
||||||
|
if (aPacket.type) {
|
||||||
|
this.emit(aPacket.type, aPacket);
|
||||||
|
}
|
||||||
|
|
||||||
let activeRequest;
|
if (activeRequest) {
|
||||||
// See if we have a handler function waiting for a reply from this
|
activeRequest.emit("json-reply", aPacket);
|
||||||
// actor. (Don't count unsolicited notifications or pauses as
|
}
|
||||||
// replies.)
|
|
||||||
if (this._activeRequests.has(aPacket.from) &&
|
|
||||||
!(aPacket.type in UnsolicitedNotifications) &&
|
|
||||||
!(aPacket.type == ThreadStateTypes.paused &&
|
|
||||||
aPacket.why.type in UnsolicitedPauses)) {
|
|
||||||
activeRequest = this._activeRequests.get(aPacket.from);
|
|
||||||
this._activeRequests.delete(aPacket.from);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Packets that indicate thread state changes get special treatment.
|
this._sendRequests();
|
||||||
if (aPacket.type in ThreadStateTypes &&
|
|
||||||
this._clients.has(aPacket.from) &&
|
|
||||||
typeof this._clients.get(aPacket.from)._onThreadState == "function") {
|
|
||||||
this._clients.get(aPacket.from)._onThreadState(aPacket);
|
|
||||||
}
|
|
||||||
// On navigation the server resumes, so the client must resume as well.
|
|
||||||
// We achieve that by generating a fake resumption packet that triggers
|
|
||||||
// the client's thread state change listeners.
|
|
||||||
if (aPacket.type == UnsolicitedNotifications.tabNavigated &&
|
|
||||||
this._clients.has(aPacket.from) &&
|
|
||||||
this._clients.get(aPacket.from).thread) {
|
|
||||||
let thread = this._clients.get(aPacket.from).thread;
|
|
||||||
let resumption = { from: thread._actor, type: "resumed" };
|
|
||||||
thread._onThreadState(resumption);
|
|
||||||
}
|
|
||||||
// Only try to notify listeners on events, not responses to requests
|
|
||||||
// that lack a packet type.
|
|
||||||
if (aPacket.type) {
|
|
||||||
this.emit(aPacket.type, aPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeRequest) {
|
|
||||||
activeRequest.emit("json-reply", aPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._sendRequests();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче