mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1025474 - Add more logging to netmonitor tests to figure out the current intermittent failures. r=rcampbell
This commit is contained in:
parent
7aca834ae2
commit
8c3e17f843
@ -539,7 +539,7 @@ NetworkEventsHandler.prototype = {
|
||||
|
||||
let { actor, startedDateTime, method, url, isXHR } = aPacket.eventActor;
|
||||
NetMonitorView.RequestsMenu.addRequest(actor, startedDateTime, method, url, isXHR);
|
||||
window.emit(EVENTS.NETWORK_EVENT);
|
||||
window.emit(EVENTS.NETWORK_EVENT, actor);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -560,23 +560,23 @@ NetworkEventsHandler.prototype = {
|
||||
switch (aPacket.updateType) {
|
||||
case "requestHeaders":
|
||||
this.webConsoleClient.getRequestHeaders(actor, this._onRequestHeaders);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_HEADERS);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_HEADERS, actor);
|
||||
break;
|
||||
case "requestCookies":
|
||||
this.webConsoleClient.getRequestCookies(actor, this._onRequestCookies);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_COOKIES);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_COOKIES, actor);
|
||||
break;
|
||||
case "requestPostData":
|
||||
this.webConsoleClient.getRequestPostData(actor, this._onRequestPostData);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_POST_DATA);
|
||||
window.emit(EVENTS.UPDATING_REQUEST_POST_DATA, actor);
|
||||
break;
|
||||
case "responseHeaders":
|
||||
this.webConsoleClient.getResponseHeaders(actor, this._onResponseHeaders);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_HEADERS);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_HEADERS, actor);
|
||||
break;
|
||||
case "responseCookies":
|
||||
this.webConsoleClient.getResponseCookies(actor, this._onResponseCookies);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_COOKIES);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_COOKIES, actor);
|
||||
break;
|
||||
case "responseStart":
|
||||
NetMonitorView.RequestsMenu.updateRequest(aPacket.from, {
|
||||
@ -585,7 +585,7 @@ NetworkEventsHandler.prototype = {
|
||||
statusText: aPacket.response.statusText,
|
||||
headersSize: aPacket.response.headersSize
|
||||
});
|
||||
window.emit(EVENTS.STARTED_RECEIVING_RESPONSE);
|
||||
window.emit(EVENTS.STARTED_RECEIVING_RESPONSE, actor);
|
||||
break;
|
||||
case "responseContent":
|
||||
NetMonitorView.RequestsMenu.updateRequest(aPacket.from, {
|
||||
@ -593,14 +593,14 @@ NetworkEventsHandler.prototype = {
|
||||
mimeType: aPacket.mimeType
|
||||
});
|
||||
this.webConsoleClient.getResponseContent(actor, this._onResponseContent);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_CONTENT);
|
||||
window.emit(EVENTS.UPDATING_RESPONSE_CONTENT, actor);
|
||||
break;
|
||||
case "eventTimings":
|
||||
NetMonitorView.RequestsMenu.updateRequest(aPacket.from, {
|
||||
totalTime: aPacket.totalTime
|
||||
});
|
||||
this.webConsoleClient.getEventTimings(actor, this._onEventTimings);
|
||||
window.emit(EVENTS.UPDATING_EVENT_TIMINGS);
|
||||
window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -615,7 +615,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
requestHeaders: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_HEADERS);
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_HEADERS, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -628,7 +628,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
requestCookies: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_COOKIES);
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_COOKIES, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -641,7 +641,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
requestPostData: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_POST_DATA);
|
||||
window.emit(EVENTS.RECEIVED_REQUEST_POST_DATA, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -654,7 +654,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
responseHeaders: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_HEADERS);
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_HEADERS, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -667,7 +667,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
responseCookies: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_COOKIES);
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_COOKIES, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -680,7 +680,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
responseContent: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_CONTENT);
|
||||
window.emit(EVENTS.RECEIVED_RESPONSE_CONTENT, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -693,7 +693,7 @@ NetworkEventsHandler.prototype = {
|
||||
NetMonitorView.RequestsMenu.updateRequest(aResponse.from, {
|
||||
eventTimings: aResponse
|
||||
});
|
||||
window.emit(EVENTS.RECEIVED_EVENT_TIMINGS);
|
||||
window.emit(EVENTS.RECEIVED_EVENT_TIMINGS, aResponse.from);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -172,65 +172,74 @@ function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let panel = aMonitor.panelWin;
|
||||
let events = panel.EVENTS;
|
||||
let menu = panel.NetMonitorView.RequestsMenu;
|
||||
|
||||
let progress = {};
|
||||
let genericEvents = 0;
|
||||
let postEvents = 0;
|
||||
|
||||
function onGenericEvent() {
|
||||
let awaitedEventsToListeners = [
|
||||
["UPDATING_REQUEST_HEADERS", onGenericEvent],
|
||||
["RECEIVED_REQUEST_HEADERS", onGenericEvent],
|
||||
["UPDATING_REQUEST_COOKIES", onGenericEvent],
|
||||
["RECEIVED_REQUEST_COOKIES", onGenericEvent],
|
||||
["UPDATING_REQUEST_POST_DATA", onPostEvent],
|
||||
["RECEIVED_REQUEST_POST_DATA", onPostEvent],
|
||||
["UPDATING_RESPONSE_HEADERS", onGenericEvent],
|
||||
["RECEIVED_RESPONSE_HEADERS", onGenericEvent],
|
||||
["UPDATING_RESPONSE_COOKIES", onGenericEvent],
|
||||
["RECEIVED_RESPONSE_COOKIES", onGenericEvent],
|
||||
["STARTED_RECEIVING_RESPONSE", onGenericEvent],
|
||||
["UPDATING_RESPONSE_CONTENT", onGenericEvent],
|
||||
["RECEIVED_RESPONSE_CONTENT", onGenericEvent],
|
||||
["UPDATING_EVENT_TIMINGS", onGenericEvent],
|
||||
["RECEIVED_EVENT_TIMINGS", onGenericEvent]
|
||||
];
|
||||
|
||||
function initProgressForURL(url) {
|
||||
if (progress[url]) return;
|
||||
progress[url] = {};
|
||||
awaitedEventsToListeners.forEach(([e]) => progress[url][e] = 0);
|
||||
}
|
||||
|
||||
function updateProgressForURL(url, event) {
|
||||
initProgressForURL(url);
|
||||
progress[url][Object.keys(events).find(e => events[e] == event)] = 1;
|
||||
}
|
||||
|
||||
function onGenericEvent(event, actor) {
|
||||
genericEvents++;
|
||||
maybeResolve();
|
||||
maybeResolve(event, actor);
|
||||
}
|
||||
|
||||
function onPostEvent() {
|
||||
function onPostEvent(event, actor) {
|
||||
postEvents++;
|
||||
maybeResolve();
|
||||
maybeResolve(event, actor);
|
||||
}
|
||||
|
||||
function maybeResolve() {
|
||||
function maybeResolve(event, actor) {
|
||||
info("> Network events progress: " +
|
||||
genericEvents + "/" + ((aGetRequests + aPostRequests) * 13) + ", " +
|
||||
postEvents + "/" + (aPostRequests * 2));
|
||||
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));
|
||||
|
||||
// There are 15 updates which need to be fired for a request to be
|
||||
// considered finished. RequestPostData isn't fired for non-POST requests.
|
||||
// considered finished. The "requestPostData" packet isn't fired for
|
||||
// non-POST requests.
|
||||
if (genericEvents == (aGetRequests + aPostRequests) * 13 &&
|
||||
postEvents == aPostRequests * 2) {
|
||||
|
||||
panel.off(panel.EVENTS.UPDATING_REQUEST_HEADERS, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_REQUEST_HEADERS, onGenericEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_REQUEST_COOKIES, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_REQUEST_COOKIES, onGenericEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_REQUEST_POST_DATA, onPostEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_REQUEST_POST_DATA, onPostEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_RESPONSE_HEADERS, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_RESPONSE_HEADERS, onGenericEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_RESPONSE_COOKIES, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_RESPONSE_COOKIES, onGenericEvent);
|
||||
panel.off(panel.EVENTS.STARTED_RECEIVING_RESPONSE, onGenericEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_RESPONSE_CONTENT, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_RESPONSE_CONTENT, onGenericEvent);
|
||||
panel.off(panel.EVENTS.UPDATING_EVENT_TIMINGS, onGenericEvent);
|
||||
panel.off(panel.EVENTS.RECEIVED_EVENT_TIMINGS, onGenericEvent);
|
||||
|
||||
awaitedEventsToListeners.forEach(([e, l]) => panel.off(events[e], l));
|
||||
executeSoon(deferred.resolve);
|
||||
}
|
||||
}
|
||||
|
||||
panel.on(panel.EVENTS.UPDATING_REQUEST_HEADERS, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_REQUEST_HEADERS, onGenericEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_REQUEST_COOKIES, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_REQUEST_COOKIES, onGenericEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_REQUEST_POST_DATA, onPostEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_REQUEST_POST_DATA, onPostEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_RESPONSE_HEADERS, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_RESPONSE_HEADERS, onGenericEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_RESPONSE_COOKIES, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_RESPONSE_COOKIES, onGenericEvent);
|
||||
panel.on(panel.EVENTS.STARTED_RECEIVING_RESPONSE, onGenericEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_RESPONSE_CONTENT, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_RESPONSE_CONTENT, onGenericEvent);
|
||||
panel.on(panel.EVENTS.UPDATING_EVENT_TIMINGS, onGenericEvent);
|
||||
panel.on(panel.EVENTS.RECEIVED_EVENT_TIMINGS, onGenericEvent);
|
||||
|
||||
awaitedEventsToListeners.forEach(([e, l]) => panel.on(events[e], l));
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user