Bug 1909613 - Enable <details name=''> everywhere, r=emilio
[gecko.git] / netwerk / base / nsITimedChannel.idl
blobcb592b884329ad3bd992bb6e5e3107b49c51834b
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"
6 interface nsIArray;
7 interface nsIPrincipal;
8 %{C++
9 namespace mozilla {
10 class TimeStamp;
12 #include "nsTArrayForwardDeclare.h"
13 #include "nsCOMPtr.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 // Set this attribute to true to enable collection of timing data.
32 // channelCreationTime will be available even with this attribute set to
33 // false.
34 attribute boolean timingEnabled;
36 // The number of redirects
37 attribute uint8_t redirectCount;
38 attribute uint8_t internalRedirectCount;
40 // These properties should only be written externally when they must be
41 // propagated across an internal redirect. For example, when a service
42 // worker interception falls back to network we need to copy the original
43 // timing values to the new nsHttpChannel.
44 [noscript] attribute TimeStamp channelCreation;
45 [noscript] attribute TimeStamp asyncOpen;
47 // The following are only set when the request is intercepted by a service
48 // worker no matter the response is synthesized.
49 [noscript] attribute TimeStamp launchServiceWorkerStart;
50 [noscript] attribute TimeStamp launchServiceWorkerEnd;
51 [noscript] attribute TimeStamp dispatchFetchEventStart;
52 [noscript] attribute TimeStamp dispatchFetchEventEnd;
53 [noscript] attribute TimeStamp handleFetchEventStart;
54 [noscript] attribute TimeStamp handleFetchEventEnd;
56 // The following are only set when the document is not (only) read from the
57 // cache
58 [noscript] readonly attribute TimeStamp domainLookupStart;
59 [noscript] readonly attribute TimeStamp domainLookupEnd;
60 [noscript] readonly attribute TimeStamp connectStart;
61 [noscript] readonly attribute TimeStamp tcpConnectEnd;
62 [noscript] readonly attribute TimeStamp secureConnectionStart;
63 [noscript] readonly attribute TimeStamp connectEnd;
64 [noscript] readonly attribute TimeStamp requestStart;
65 [noscript] readonly attribute TimeStamp responseStart;
66 [noscript] readonly attribute TimeStamp responseEnd;
68 // The redirect attributes timings must be writeble, se we can transfer
69 // the data from one channel to the redirected channel.
70 [noscript] attribute TimeStamp redirectStart;
71 [noscript] attribute TimeStamp redirectEnd;
73 // The initiator type
74 [noscript] attribute AString initiatorType;
76 // This flag should be set to false only if a cross-domain redirect occurred
77 [noscript] attribute boolean allRedirectsSameOrigin;
78 // This flag is set to false if the timing allow check fails
79 [noscript] attribute boolean allRedirectsPassTimingAllowCheck;
80 // Implements the timing-allow-check to determine if we should report
81 // timing info for the resourceTiming object.
82 [noscript] boolean timingAllowCheck(in nsIPrincipal origin);
83 %{C++
84 inline bool TimingAllowCheck(nsIPrincipal* aOrigin) {
85 bool allowed = false;
86 return NS_SUCCEEDED(TimingAllowCheck(aOrigin, &allowed)) && allowed;
89 // Determines if bodyInfo should be opaque to the given origin
90 cenum BodyInfoAccess : 8 {
91 DISALLOWED = 0,
92 ALLOW_SIZES = 1,
93 ALLOW_ALL = 2
95 [noscript] nsITimedChannel_BodyInfoAccess bodyInfoAccessAllowedCheck(in nsIPrincipal origin);
96 %{C++
97 inline BodyInfoAccess BodyInfoAccessAllowedCheck(nsIPrincipal* aOrigin) {
98 BodyInfoAccess allowed = BodyInfoAccess::DISALLOWED;
99 mozilla::Unused << BodyInfoAccessAllowedCheck(aOrigin, &allowed);
100 return allowed;
104 // Whether this request is render-blocking:
105 // https://w3c.github.io/resource-timing/#dom-renderblockingstatustype
106 [noscript] attribute boolean renderBlocking;
108 // The following are only set if the document is (partially) read from the
109 // cache
110 [noscript] readonly attribute TimeStamp cacheReadStart;
111 [noscript] readonly attribute TimeStamp cacheReadEnd;
113 // The time when the transaction was submitted to the Connection Manager.
114 // Not reported to resource/navigation timing, only for performance telemetry.
115 [noscript] readonly attribute TimeStamp transactionPending;
117 // All following are PRTime versions of the above.
118 readonly attribute PRTime channelCreationTime;
119 readonly attribute PRTime asyncOpenTime;
120 readonly attribute PRTime launchServiceWorkerStartTime;
121 readonly attribute PRTime launchServiceWorkerEndTime;
122 readonly attribute PRTime dispatchFetchEventStartTime;
123 readonly attribute PRTime dispatchFetchEventEndTime;
124 readonly attribute PRTime handleFetchEventStartTime;
125 readonly attribute PRTime handleFetchEventEndTime;
126 readonly attribute PRTime domainLookupStartTime;
127 readonly attribute PRTime domainLookupEndTime;
128 readonly attribute PRTime connectStartTime;
129 readonly attribute PRTime tcpConnectEndTime;
130 readonly attribute PRTime secureConnectionStartTime;
131 readonly attribute PRTime connectEndTime;
132 readonly attribute PRTime requestStartTime;
133 readonly attribute PRTime responseStartTime;
134 readonly attribute PRTime responseEndTime;
135 readonly attribute PRTime cacheReadStartTime;
136 readonly attribute PRTime cacheReadEndTime;
137 readonly attribute PRTime redirectStartTime;
138 readonly attribute PRTime redirectEndTime;
139 // Not reported to resource/navigation timing, only for performance telemetry.
140 readonly attribute PRTime transactionPendingTime;
142 // If this attribute is false, this resource MUST NOT be reported in resource timing.
143 [noscript] attribute boolean reportResourceTiming;
145 readonly attribute nsIArray serverTiming;
146 [noscript] nsServerTimingArrayRef getNativeServerTiming();