1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
7 interface nsIPrincipal
;
12 #include
"nsTArrayForwardDeclare.h"
16 native TimeStamp
(mozilla
::TimeStamp
);
18 [scriptable
, uuid(c2d9e95b
-9cc9
-4f47
-9ef6
-1de0cf7ebc75
)]
19 interface nsIServerTiming
: nsISupports
{
20 [must_use
] readonly attribute ACString name
;
21 [must_use
] readonly attribute
double duration
;
22 [must_use
] readonly attribute ACString description
;
25 [ref] native nsServerTimingArrayRef
(nsTArray
<nsCOMPtr
<nsIServerTiming
>>);
27 // All properties return zero if the value is not available
28 [scriptable
, uuid(ca63784d
-959c
-4c3a
-9a59
-234a2a520de0
)]
29 interface nsITimedChannel
: nsISupports
{
30 // Set this attribute to true to enable collection of timing data.
31 // channelCreationTime will be available even with this attribute set to
33 attribute
boolean timingEnabled
;
35 // The number of redirects
36 attribute uint8_t redirectCount
;
37 attribute uint8_t internalRedirectCount
;
39 // These properties should only be written externally when they must be
40 // propagated across an internal redirect. For example, when a service
41 // worker interception falls back to network we need to copy the original
42 // timing values to the new nsHttpChannel.
43 [noscript
] attribute TimeStamp channelCreation
;
44 [noscript
] attribute TimeStamp asyncOpen
;
46 // The following are only set when the request is intercepted by a service
47 // worker no matter the response is synthesized.
48 [noscript
] attribute TimeStamp launchServiceWorkerStart
;
49 [noscript
] attribute TimeStamp launchServiceWorkerEnd
;
50 [noscript
] attribute TimeStamp dispatchFetchEventStart
;
51 [noscript
] attribute TimeStamp dispatchFetchEventEnd
;
52 [noscript
] attribute TimeStamp handleFetchEventStart
;
53 [noscript
] attribute TimeStamp handleFetchEventEnd
;
55 // The following are only set when the document is not (only) read from the
57 [noscript
] readonly attribute TimeStamp domainLookupStart
;
58 [noscript
] readonly attribute TimeStamp domainLookupEnd
;
59 [noscript
] readonly attribute TimeStamp connectStart
;
60 [noscript
] readonly attribute TimeStamp tcpConnectEnd
;
61 [noscript
] readonly attribute TimeStamp secureConnectionStart
;
62 [noscript
] readonly attribute TimeStamp connectEnd
;
63 [noscript
] readonly attribute TimeStamp requestStart
;
64 [noscript
] readonly attribute TimeStamp responseStart
;
65 [noscript
] readonly attribute TimeStamp responseEnd
;
67 // The redirect attributes timings must be writeble, se we can transfer
68 // the data from one channel to the redirected channel.
69 [noscript
] attribute TimeStamp redirectStart
;
70 [noscript
] attribute TimeStamp redirectEnd
;
73 [noscript
] attribute AString initiatorType
;
75 // This flag should be set to false only if a cross-domain redirect occurred
76 [noscript
] attribute
boolean allRedirectsSameOrigin
;
77 // This flag is set to false if the timing allow check fails
78 [noscript
] attribute
boolean allRedirectsPassTimingAllowCheck
;
79 // Implements the timing-allow-check to determine if we should report
80 // timing info for the resourceTiming object.
81 [noscript
] boolean timingAllowCheck
(in nsIPrincipal origin
);
83 inline bool TimingAllowCheck
(nsIPrincipal
* aOrigin
) {
85 return NS_SUCCEEDED
(TimingAllowCheck
(aOrigin
, &allowed
)) && allowed
;
89 // The following are only set if the document is (partially) read from the
91 [noscript
] readonly attribute TimeStamp cacheReadStart
;
92 [noscript
] readonly attribute TimeStamp cacheReadEnd
;
94 // The time when the transaction was submitted to the Connection Manager.
95 // Not reported to resource/navigation timing, only for performance telemetry.
96 [noscript
] readonly attribute TimeStamp transactionPending
;
98 // All following are PRTime versions of the above.
99 readonly attribute PRTime channelCreationTime
;
100 readonly attribute PRTime asyncOpenTime
;
101 readonly attribute PRTime launchServiceWorkerStartTime
;
102 readonly attribute PRTime launchServiceWorkerEndTime
;
103 readonly attribute PRTime dispatchFetchEventStartTime
;
104 readonly attribute PRTime dispatchFetchEventEndTime
;
105 readonly attribute PRTime handleFetchEventStartTime
;
106 readonly attribute PRTime handleFetchEventEndTime
;
107 readonly attribute PRTime domainLookupStartTime
;
108 readonly attribute PRTime domainLookupEndTime
;
109 readonly attribute PRTime connectStartTime
;
110 readonly attribute PRTime tcpConnectEndTime
;
111 readonly attribute PRTime secureConnectionStartTime
;
112 readonly attribute PRTime connectEndTime
;
113 readonly attribute PRTime requestStartTime
;
114 readonly attribute PRTime responseStartTime
;
115 readonly attribute PRTime responseEndTime
;
116 readonly attribute PRTime cacheReadStartTime
;
117 readonly attribute PRTime cacheReadEndTime
;
118 readonly attribute PRTime redirectStartTime
;
119 readonly attribute PRTime redirectEndTime
;
120 // Not reported to resource/navigation timing, only for performance telemetry.
121 readonly attribute PRTime transactionPendingTime
;
123 // If this attribute is false, this resource MUST NOT be reported in resource timing.
124 [noscript
] attribute
boolean reportResourceTiming
;
126 readonly attribute nsIArray serverTiming
;
127 nsServerTimingArrayRef getNativeServerTiming
();