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