From b08d8d8287021f011cba44c16c7308cc0e0dcb5e Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 21 Apr 2017 15:25:22 +0200 Subject: [PATCH] Backed out changeset f6a1f5acfd58 (bug 1356957) --- .../netmonitor/src/netmonitor-controller.js | 44 +++++++++---------- .../test/browser_net_simple-request-data.js | 17 ++++++- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/devtools/client/netmonitor/src/netmonitor-controller.js b/devtools/client/netmonitor/src/netmonitor-controller.js index eba4fd8ee74d..727981be55a1 100644 --- a/devtools/client/netmonitor/src/netmonitor-controller.js +++ b/devtools/client/netmonitor/src/netmonitor-controller.js @@ -304,6 +304,8 @@ function NetworkEventsHandler() { this._onRequestPostData = this._onRequestPostData.bind(this); this._onResponseHeaders = this._onResponseHeaders.bind(this); this._onResponseCookies = this._onResponseCookies.bind(this); + this._onSecurityInfo = this._onSecurityInfo.bind(this); + this._onEventTimings = this._onEventTimings.bind(this); } NetworkEventsHandler.prototype = { @@ -586,12 +588,12 @@ NetworkEventsHandler.prototype = { window.emit(EVENTS.UPDATING_REQUEST_POST_DATA, actor); break; case "securityInfo": - this.webConsoleClient.getSecurityInfo(actor, - this._onSecurityInfo.bind(this, { - securityState: networkInfo.securityInfo, - }) - ); - window.emit(EVENTS.UPDATING_SECURITY_INFO, actor); + this.updateRequest(actor, { + securityState: networkInfo.securityInfo, + }).then(() => { + this.webConsoleClient.getSecurityInfo(actor, this._onSecurityInfo); + window.emit(EVENTS.UPDATING_SECURITY_INFO, actor); + }); break; case "responseHeaders": this.webConsoleClient.getResponseHeaders(actor, @@ -625,12 +627,12 @@ NetworkEventsHandler.prototype = { window.emit(EVENTS.UPDATING_RESPONSE_CONTENT, actor); break; case "eventTimings": - this.webConsoleClient.getEventTimings(actor, - this._onEventTimings.bind(this, { - totalTime: networkInfo.totalTime - }) - ); - window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor); + this.updateRequest(actor, { + totalTime: networkInfo.totalTime + }).then(() => { + this.webConsoleClient.getEventTimings(actor, this._onEventTimings); + window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor); + }); break; } }, @@ -680,16 +682,13 @@ NetworkEventsHandler.prototype = { /** * Handles additional information received for a "securityInfo" packet. * - * @param object data - * The message received from the server event. * @param object response * The message received from the server. */ - _onSecurityInfo: function (data, response) { - let payload = Object.assign({ + _onSecurityInfo: function (response) { + this.updateRequest(response.from, { securityInfo: response.securityInfo - }, data); - this.updateRequest(response.from, payload).then(() => { + }).then(() => { window.emit(EVENTS.RECEIVED_SECURITY_INFO, response.from); }); }, @@ -740,14 +739,13 @@ NetworkEventsHandler.prototype = { /** * Handles additional information received for a "eventTimings" packet. * - * @param object data - * The message received from the server event. * @param object response * The message received from the server. */ - _onEventTimings: function (data, response) { - let payload = Object.assign({ eventTimings: response }, data); - this.updateRequest(response.from, payload).then(() => { + _onEventTimings: function (response) { + this.updateRequest(response.from, { + eventTimings: response + }).then(() => { window.emit(EVENTS.RECEIVED_EVENT_TIMINGS, response.from); }); } diff --git a/devtools/client/netmonitor/test/browser_net_simple-request-data.js b/devtools/client/netmonitor/test/browser_net_simple-request-data.js index e3440f9e5aec..cbd5908f283f 100644 --- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js +++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js @@ -233,7 +233,7 @@ function test() { ); }); - monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS, () => { + monitor.panelWin.once(EVENTS.UPDATING_EVENT_TIMINGS, () => { let requestItem = getSortedRequests(gStore.getState()).get(0); is(typeof requestItem.totalTime, "number", @@ -241,6 +241,21 @@ function test() { ok(requestItem.totalTime >= 0, "The attached totalTime should be positive."); + verifyRequestItemTarget( + document, + getDisplayedRequests(gStore.getState()), + requestItem, + "GET", + SIMPLE_SJS, + { + time: true + } + ); + }); + + monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS, () => { + let requestItem = getSortedRequests(gStore.getState()).get(0); + ok(requestItem.eventTimings, "There should be a eventTimings data available."); is(typeof requestItem.eventTimings.timings.blocked, "number",