Skip to content

Commit

Permalink
Bug 1300058 - Part 1: Handle incoming network event packets. r=linclark
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 6Dmeb6wbIGi
  • Loading branch information
steveck-chung committed Sep 20, 2016
1 parent 0ceff99 commit f3be091
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions devtools/client/webconsole/new-console-output/utils/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ function transformPacket(packet) {
});
}

case "networkEvent": {
let { networkEvent } = packet;

// TODO: Replace the ConsoleMessage with NetworkEventMessage
// once the new component is ready.
return new ConsoleMessage({
source: MESSAGE_SOURCE.CONSOLE_API,
type: MESSAGE_TYPE.LOG,
level: MESSAGE_LEVEL.LOG,
messageText: networkEvent.request.method + " " + networkEvent.request.url,
});
}
case "evaluationResult":
default: {
let { result } = packet;
Expand Down Expand Up @@ -165,6 +177,9 @@ function convertCachedPacket(packet) {
} else if ("_navPayload" in packet) {
convertPacket.type = "navigationMessage";
convertPacket.message = packet;
} else if (packet._type === "NetworkEvent") {
convertPacket.networkEvent = packet;
convertPacket.type = "networkEvent";
} else {
throw new Error("Unexpected packet type");
}
Expand Down
4 changes: 4 additions & 0 deletions devtools/client/webconsole/webconsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,10 @@ WebConsoleConnectionProxy.prototype = {
*/
_onNetworkEvent: function (type, networkInfo) {
if (this.webConsoleFrame) {
if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
this.dispatchMessageAdd(networkInfo);
return;
}
this.webConsoleFrame.handleNetworkEvent(networkInfo);
}
},
Expand Down

0 comments on commit f3be091

Please sign in to comment.