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"
14 #include
"mozilla/Unused.h"
17 native TimeStamp
(mozilla
::TimeStamp
);
19 [scriptable
, uuid(c2d9e95b
-9cc9
-4f47
-9ef6
-1de0cf7ebc75
)]
20 interface nsIServerTiming
: nsISupports
{
21 [must_use
] readonly attribute ACString name
;
22 [must_use
] readonly attribute
double duration
;
23 [must_use
] readonly attribute ACString description
;
26 [ref] native nsServerTimingArrayRef
(nsTArray
<nsCOMPtr
<nsIServerTiming
>>);
28 // All properties return zero if the value is not available
29 [scriptable
, builtinclass
, uuid(ca63784d
-959c
-4c3a
-9a59
-234a2a520de0
)]
30 interface nsITimedChannel
: nsISupports
{
31 // The number of redirects
32 attribute uint8_t redirectCount
;
33 attribute uint8_t internalRedirectCount
;
35 // These properties should only be written externally when they must be
36 // propagated across an internal redirect. For example, when a service
37 // worker interception falls back to network we need to copy the original
38 // timing values to the new nsHttpChannel.
39 [noscript
] attribute TimeStamp channelCreation
;
40 [noscript
] attribute TimeStamp asyncOpen
;
42 // The following are only set when the request is intercepted by a service
43 // worker no matter the response is synthesized.
44 [noscript
] attribute TimeStamp launchServiceWorkerStart
;
45 [noscript
] attribute TimeStamp launchServiceWorkerEnd
;
46 [noscript
] attribute TimeStamp dispatchFetchEventStart
;
47 [noscript
] attribute TimeStamp dispatchFetchEventEnd
;
48 [noscript
] attribute TimeStamp handleFetchEventStart
;
49 [noscript
] attribute TimeStamp handleFetchEventEnd
;
51 // The following are only set when the document is not (only) read from the
53 [noscript
] readonly attribute TimeStamp domainLookupStart
;
54 [noscript
] readonly attribute TimeStamp domainLookupEnd
;
55 [noscript
] readonly attribute TimeStamp connectStart
;
56 [noscript
] readonly attribute TimeStamp tcpConnectEnd
;
57 [noscript
] readonly attribute TimeStamp secureConnectionStart
;
58 [noscript
] readonly attribute TimeStamp connectEnd
;
59 [noscript
] readonly attribute TimeStamp requestStart
;
60 [noscript
] readonly attribute TimeStamp responseStart
;
61 [noscript
] readonly attribute TimeStamp responseEnd
;
63 // The redirect attributes timings must be writeble, se we can transfer
64 // the data from one channel to the redirected channel.
65 [noscript
] attribute TimeStamp redirectStart
;
66 [noscript
] attribute TimeStamp redirectEnd
;
69 attribute AString initiatorType
;
71 // This flag should be set to false only if a cross-domain redirect occurred
72 [noscript
] attribute
boolean allRedirectsSameOrigin
;
73 // This flag is set to false if the timing allow check fails
74 [noscript
] attribute
boolean allRedirectsPassTimingAllowCheck
;
75 // Implements the timing-allow-check to determine if we should report
76 // timing info for the resourceTiming object.
77 [noscript
] boolean timingAllowCheck
(in nsIPrincipal origin
);
79 inline bool TimingAllowCheck
(nsIPrincipal
* aOrigin
) {
81 return NS_SUCCEEDED
(TimingAllowCheck
(aOrigin
, &allowed
)) && allowed
;
84 // Determines if bodyInfo should be opaque to the given origin
85 cenum BodyInfoAccess
: 8 {
90 [noscript
] nsITimedChannel_BodyInfoAccess bodyInfoAccessAllowedCheck
(in nsIPrincipal origin
);
92 inline BodyInfoAccess BodyInfoAccessAllowedCheck
(nsIPrincipal
* aOrigin
) {
93 BodyInfoAccess allowed
= BodyInfoAccess
::DISALLOWED
;
94 mozilla
::Unused
<< BodyInfoAccessAllowedCheck
(aOrigin
, &allowed
);
99 // Whether this request is render-blocking:
100 // https://w3c.github.io/resource-timing/#dom-renderblockingstatustype
101 [noscript
] attribute
boolean renderBlocking
;
103 // The following are only set if the document is (partially) read from the
105 [noscript
] readonly attribute TimeStamp cacheReadStart
;
106 [noscript
] readonly attribute TimeStamp cacheReadEnd
;
108 // The time when the transaction was submitted to the Connection Manager.
109 // Not reported to resource/navigation timing, only for performance telemetry.
110 [noscript
] readonly attribute TimeStamp transactionPending
;
112 // All following are PRTime versions of the above.
113 readonly attribute PRTime channelCreationTime
;
114 readonly attribute PRTime asyncOpenTime
;
115 readonly attribute PRTime launchServiceWorkerStartTime
;
116 readonly attribute PRTime launchServiceWorkerEndTime
;
117 readonly attribute PRTime dispatchFetchEventStartTime
;
118 readonly attribute PRTime dispatchFetchEventEndTime
;
119 readonly attribute PRTime handleFetchEventStartTime
;
120 readonly attribute PRTime handleFetchEventEndTime
;
121 readonly attribute PRTime domainLookupStartTime
;
122 readonly attribute PRTime domainLookupEndTime
;
123 readonly attribute PRTime connectStartTime
;
124 readonly attribute PRTime tcpConnectEndTime
;
125 readonly attribute PRTime secureConnectionStartTime
;
126 readonly attribute PRTime connectEndTime
;
127 readonly attribute PRTime requestStartTime
;
128 readonly attribute PRTime responseStartTime
;
129 readonly attribute PRTime responseEndTime
;
130 readonly attribute PRTime cacheReadStartTime
;
131 readonly attribute PRTime cacheReadEndTime
;
132 readonly attribute PRTime redirectStartTime
;
133 readonly attribute PRTime redirectEndTime
;
134 // Not reported to resource/navigation timing, only for performance telemetry.
135 readonly attribute PRTime transactionPendingTime
;
137 // If this attribute is false, this resource MUST NOT be reported in resource timing.
138 [noscript
] attribute
boolean reportResourceTiming
;
140 readonly attribute nsIArray serverTiming
;
141 [noscript
] nsServerTimingArrayRef getNativeServerTiming
();