Bug 1162961 - Fix logspam in mochitest-dt by passing the URL along in network progress events;r=past

This way there isn't a need to rely on the netmonitor view being present
This commit is contained in:
Brian Grinstead 2015-05-11 10:32:42 +03:00 committed by Panos Astithas
parent ff65d4bbaf
commit 76867ea1e5
2 changed files with 11 additions and 13 deletions

View File

@ -520,35 +520,35 @@ NetworkEventsHandler.prototype = {
* The network request information.
*/
_onNetworkEventUpdate: function(type, { packet, networkInfo }) {
let actor = networkInfo.actor;
let { actor, request: { url } } = networkInfo;
switch (packet.updateType) {
case "requestHeaders":
this.webConsoleClient.getRequestHeaders(actor, this._onRequestHeaders);
window.emit(EVENTS.UPDATING_REQUEST_HEADERS, actor);
window.emit(EVENTS.UPDATING_REQUEST_HEADERS, [actor, url]);
break;
case "requestCookies":
this.webConsoleClient.getRequestCookies(actor, this._onRequestCookies);
window.emit(EVENTS.UPDATING_REQUEST_COOKIES, actor);
window.emit(EVENTS.UPDATING_REQUEST_COOKIES, [actor, url]);
break;
case "requestPostData":
this.webConsoleClient.getRequestPostData(actor, this._onRequestPostData);
window.emit(EVENTS.UPDATING_REQUEST_POST_DATA, actor);
window.emit(EVENTS.UPDATING_REQUEST_POST_DATA, [actor, url]);
break;
case "securityInfo":
NetMonitorView.RequestsMenu.updateRequest(actor, {
securityState: networkInfo.securityInfo,
});
this.webConsoleClient.getSecurityInfo(actor, this._onSecurityInfo);
window.emit(EVENTS.UPDATING_SECURITY_INFO, actor);
window.emit(EVENTS.UPDATING_SECURITY_INFO, [actor, url]);
break;
case "responseHeaders":
this.webConsoleClient.getResponseHeaders(actor, this._onResponseHeaders);
window.emit(EVENTS.UPDATING_RESPONSE_HEADERS, actor);
window.emit(EVENTS.UPDATING_RESPONSE_HEADERS, [actor, url]);
break;
case "responseCookies":
this.webConsoleClient.getResponseCookies(actor, this._onResponseCookies);
window.emit(EVENTS.UPDATING_RESPONSE_COOKIES, actor);
window.emit(EVENTS.UPDATING_RESPONSE_COOKIES, [actor, url]);
break;
case "responseStart":
NetMonitorView.RequestsMenu.updateRequest(actor, {
@ -559,7 +559,7 @@ NetworkEventsHandler.prototype = {
statusText: networkInfo.response.statusText,
headersSize: networkInfo.response.headersSize
});
window.emit(EVENTS.STARTED_RECEIVING_RESPONSE, actor);
window.emit(EVENTS.STARTED_RECEIVING_RESPONSE, [actor, url]);
break;
case "responseContent":
NetMonitorView.RequestsMenu.updateRequest(actor, {
@ -568,14 +568,14 @@ NetworkEventsHandler.prototype = {
mimeType: networkInfo.response.content.mimeType
});
this.webConsoleClient.getResponseContent(actor, this._onResponseContent);
window.emit(EVENTS.UPDATING_RESPONSE_CONTENT, actor);
window.emit(EVENTS.UPDATING_RESPONSE_CONTENT, [actor, url]);
break;
case "eventTimings":
NetMonitorView.RequestsMenu.updateRequest(actor, {
totalTime: networkInfo.totalTime
});
this.webConsoleClient.getEventTimings(actor, this._onEventTimings);
window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor);
window.emit(EVENTS.UPDATING_EVENT_TIMINGS, [actor, url]);
break;
}
},

View File

@ -193,7 +193,6 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
let panel = aMonitor.panelWin;
let events = panel.EVENTS;
let menu = panel.NetMonitorView.RequestsMenu;
let progress = {};
let genericEvents = 0;
@ -238,13 +237,12 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
maybeResolve(event, actor);
}
function maybeResolve(event, actor) {
function maybeResolve(event, [actor, url]) {
info("> Network events progress: " +
genericEvents + "/" + ((aGetRequests + aPostRequests) * 13) + ", " +
postEvents + "/" + (aPostRequests * 2) + ", " +
"got " + event + " for " + actor);
let url = menu.getItemByValue(actor).attachment.url;
updateProgressForURL(url, event);
info("> Current state: " + JSON.stringify(progress, null, 2));