@@ -21,6 +21,8 @@ const kCacheMode = Symbol('kCacheMode');
2121const kRequestedUrl = Symbol ( 'kRequestedUrl' ) ;
2222const kTimingInfo = Symbol ( 'kTimingInfo' ) ;
2323const kInitiatorType = Symbol ( 'kInitiatorType' ) ;
24+ const kDeliveryType = Symbol ( 'kDeliveryType' ) ;
25+ const kResponseStatus = Symbol ( 'kResponseStatus' ) ;
2426
2527class PerformanceResourceTiming extends PerformanceEntry {
2628 constructor ( skipThrowSymbol = undefined , name = undefined , type = undefined ) {
@@ -136,6 +138,16 @@ class PerformanceResourceTiming extends PerformanceEntry {
136138 return this [ kTimingInfo ] . encodedBodySize + 300 ;
137139 }
138140
141+ get deliveryType ( ) {
142+ validateInternalField ( this , kTimingInfo , 'PerformanceResourceTiming' ) ;
143+ return this [ kDeliveryType ] ;
144+ }
145+
146+ get responseStatus ( ) {
147+ validateInternalField ( this , kTimingInfo , 'PerformanceResourceTiming' ) ;
148+ return this [ kResponseStatus ] ;
149+ }
150+
139151 toJSON ( ) {
140152 validateInternalField ( this , kInitiatorType , 'PerformanceResourceTiming' ) ;
141153 return {
@@ -160,6 +172,8 @@ class PerformanceResourceTiming extends PerformanceEntry {
160172 transferSize : this . transferSize ,
161173 encodedBodySize : this . encodedBodySize ,
162174 decodedBodySize : this . decodedBodySize ,
175+ deliveryType : this . deliveryType ,
176+ responseStatus : this . responseStatus ,
163177 } ;
164178 }
165179}
@@ -182,6 +196,8 @@ ObjectDefineProperties(PerformanceResourceTiming.prototype, {
182196 transferSize : kEnumerableProperty ,
183197 encodedBodySize : kEnumerableProperty ,
184198 decodedBodySize : kEnumerableProperty ,
199+ deliveryType : kEnumerableProperty ,
200+ responseStatus : kEnumerableProperty ,
185201 toJSON : kEnumerableProperty ,
186202 [ SymbolToStringTag ] : {
187203 __proto__ : null ,
@@ -190,7 +206,15 @@ ObjectDefineProperties(PerformanceResourceTiming.prototype, {
190206 } ,
191207} ) ;
192208
193- function createPerformanceResourceTiming ( requestedUrl , initiatorType , timingInfo , cacheMode = '' ) {
209+ function createPerformanceResourceTiming (
210+ requestedUrl ,
211+ initiatorType ,
212+ timingInfo ,
213+ cacheMode = '' ,
214+ bodyInfo ,
215+ responseStatus ,
216+ deliveryType ,
217+ ) {
194218 const resourceTiming = new PerformanceResourceTiming ( kSkipThrow , requestedUrl , 'resource' ) ;
195219
196220 resourceTiming [ kInitiatorType ] = initiatorType ;
@@ -200,6 +224,8 @@ function createPerformanceResourceTiming(requestedUrl, initiatorType, timingInfo
200224 // The spec doesn't say to validate it in the class construction.
201225 resourceTiming [ kTimingInfo ] = timingInfo ;
202226 resourceTiming [ kCacheMode ] = cacheMode ;
227+ resourceTiming [ kDeliveryType ] = deliveryType ;
228+ resourceTiming [ kResponseStatus ] = responseStatus ;
203229
204230 return resourceTiming ;
205231}
@@ -211,6 +237,9 @@ function markResourceTiming(
211237 initiatorType ,
212238 global ,
213239 cacheMode ,
240+ bodyInfo ,
241+ responseStatus ,
242+ deliveryType = '' ,
214243) {
215244 // https://w3c.github.io/resource-timing/#dfn-setup-the-resource-timing-entry
216245 assert (
@@ -222,6 +251,9 @@ function markResourceTiming(
222251 initiatorType ,
223252 timingInfo ,
224253 cacheMode ,
254+ bodyInfo ,
255+ responseStatus ,
256+ deliveryType ,
225257 ) ;
226258
227259 enqueue ( resource ) ;
0 commit comments