File tree 1 file changed +15
-3
lines changed 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,22 @@ export const buildFieldsFromTiming = function buildFieldsFromTiming(
34
34
const totalServer = timing . responseEnd - timing . requestStart
35
35
36
36
// UI measurements
37
- const domProcessing = timing . domComplete - timing . responseEnd
38
- const domContentLoading = timing . domComplete - timing . domInteractive
39
- const windowLoadEvent = timing . loadEventEnd - timing . loadEventStart
37
+ let domProcessing = timing . responseEnd
38
+ let domContentLoading = timing . domInteractive
39
+ let windowLoadEvent = timing . loadEventStart
40
40
41
+ // these values will be 0 if the event hasn't fired (e.g. because it's not finished) before the request is sent
42
+ if ( timing . domComplete > 0 ) {
43
+ domProcessing = timing . domComplete - timing . responseEnd
44
+ }
45
+ if ( timing . domComplete > 0 ) {
46
+ domContentLoading = timing . domComplete - timing . domInteractive
47
+ }
48
+ if ( windowLoadEvent > 0 ) {
49
+ windowLoadEvent = timing . loadEventEnd - timing . loadEventStart
50
+ }
51
+
52
+ // tls and worker may not be set by the user agent - guard against that
41
53
let tls = 0
42
54
if ( timing . secureConnectionStart > 0 ) {
43
55
tls = timing . connectEnd - timing . secureConnectionStart
You can’t perform that action at this time.
0 commit comments