Bug 862341 Part 2: Display cached network requests in the web console. r=vporof

This commit is contained in:
Panos Astithas 2015-04-27 19:59:35 +03:00
Родитель f72a8005f9
Коммит 968c753795
5 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -440,7 +440,6 @@ function TargetEventsHandler() {
TargetEventsHandler.prototype = {
get target() NetMonitorController._target,
get webConsoleClient() NetMonitorController.webConsoleClient,
/**
* Listen for events emitted by the current tab target.

Просмотреть файл

@ -1213,6 +1213,9 @@ WebConsoleFrame.prototype = {
this.outputMessage(CATEGORY_WEBDEV, this.logConsoleAPIMessage,
[aMessage]);
break;
case "NetworkEvent":
this.outputMessage(CATEGORY_NETWORK, this.logNetEvent, [aMessage]);
break;
}
}, this);
},
@ -1546,7 +1549,8 @@ WebConsoleFrame.prototype = {
let messageNode = this.createMessageNode(CATEGORY_NETWORK, severity,
methodNode, null, null,
clipboardText);
clipboardText, null,
networkInfo.timeStamp);
if (networkInfo.private) {
messageNode.setAttribute("private", true);
}
@ -5140,7 +5144,10 @@ WebConsoleConnectionProxy.prototype = {
Cu.reportError("Web Console getCachedMessages error: invalid state.");
}
this.owner.displayCachedMessages(aResponse.messages);
let messages = aResponse.messages.concat(...this.webConsoleClient.getNetworkEvents());
messages.sort((a, b) => a.timeStamp - b.timeStamp);
this.owner.displayCachedMessages(messages);
if (!this._hasNativeConsoleAPI) {
this.owner.logWarningAboutReplacedAPI();

Просмотреть файл

@ -734,8 +734,6 @@ WebConsoleActor.prototype =
}
}
messages.sort(function(a, b) { return a.timeStamp - b.timeStamp; });
return {
from: this.actorID,
messages: messages,
@ -1606,6 +1604,7 @@ NetworkEventActor.prototype =
return {
actor: this.actorID,
startedDateTime: this._startedDateTime,
timeStamp: Date.parse(this._startedDateTime),
url: this._request.url,
method: this._request.method,
isXHR: this._isXHR,

Просмотреть файл

@ -68,6 +68,10 @@ WebConsoleClient.prototype = {
this._networkRequests.delete(actorId);
},
getNetworkEvents() {
return this._networkRequests.values();
},
get actor() { return this._actor; },
/**
@ -85,6 +89,8 @@ WebConsoleClient.prototype = {
if (packet.from == this._actor) {
let actor = packet.eventActor;
let networkInfo = {
_type: "NetworkEvent",
timeStamp: actor.timeStamp,
node: null,
actor: actor.actor,
discardRequestBody: true,

Просмотреть файл

@ -1496,13 +1496,6 @@ ConsoleAPIListener.prototype =
messages = messages.filter((m) => m.consoleID == this.consoleID);
}
// ConsoleAPIStorage gives up messages sorted, but we ask for different
// blocks of events and we must sort them again in order to show them in the
// proper order.
messages = messages.sort(function(a, b) {
return a.timeStamp - b.timeStamp;
});
if (aIncludePrivate) {
return messages;
}