From 644e9db1092df1477b1facc52cd3ee45ebd13040 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Thu, 1 Mar 2018 11:52:50 +0100 Subject: DevTools - network - implement the secureConnectionStart property for the PerformanceTiming https://github.com/MoonchildProductions/moebius/pull/116 ("/testing" and "/toolkit" in in the previous commit) --- devtools/shared/webconsole/network-monitor.js | 35 ++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'devtools/shared') diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index 5416a7760..bda745520 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -732,7 +732,9 @@ NetworkMonitor.prototype = { 0x804b0004: "STATUS_CONNECTED_TO", 0x804b0005: "STATUS_SENDING_TO", 0x804b000a: "STATUS_WAITING_FOR", - 0x804b0006: "STATUS_RECEIVING_FROM" + 0x804b0006: "STATUS_RECEIVING_FROM", + 0x804b000c: "STATUS_TLS_STARTING", + 0x804b000d: "STATUS_TLS_ENDING" }, httpDownloadActivities: [ @@ -1406,6 +1408,7 @@ NetworkMonitor.prototype = { timings: { blocked: 0, dns: 0, + ssl: 0, connect: 0, send: 0, wait: 0, @@ -1440,6 +1443,36 @@ NetworkMonitor.prototype = { harTimings.connect = -1; } + if (timings.STATUS_TLS_STARTING && timings.STATUS_TLS_ENDING) { + harTimings.ssl = timings.STATUS_TLS_ENDING.last - + timings.STATUS_TLS_STARTING.first; + } else { + harTimings.ssl = -1; + } + + // sometimes the connection information events are attached to a speculative + // channel instead of this one, but necko might glue them back together in the + // nsITimedChannel interface used by Resource and Navigation Timing + let timedChannel = httpActivity.channel.QueryInterface(Ci.nsITimedChannel); + + if ((harTimings.connect <= 0) && timedChannel) { + if (timedChannel.secureConnectionStartTime > timedChannel.connectStartTime) { + harTimings.connect = + timedChannel.secureConnectionStartTime - timedChannel.connectStartTime; + harTimings.ssl = + timedChannel.connectEndTime - timedChannel.secureConnectionStartTime; + } else { + harTimings.connect = + timedChannel.connectEndTime - timedChannel.connectStartTime; + harTimings.ssl = -1; + } + } + + if ((harTimings.dns <= 0) && timedChannel) { + harTimings.dns = + timedChannel.domainLookupEndTime - timedChannel.domainLookupStartTime; + } + if (timings.STATUS_SENDING_TO) { harTimings.send = timings.STATUS_SENDING_TO.last - timings.STATUS_SENDING_TO.first; } else if (timings.REQUEST_HEADER && timings.REQUEST_BODY_SENT) { -- cgit v1.2.3