@@ -21,6 +21,8 @@ const kCacheMode = Symbol('kCacheMode');
21
21
const kRequestedUrl = Symbol ( 'kRequestedUrl' ) ;
22
22
const kTimingInfo = Symbol ( 'kTimingInfo' ) ;
23
23
const kInitiatorType = Symbol ( 'kInitiatorType' ) ;
24
+ const kDeliveryType = Symbol ( 'kDeliveryType' ) ;
25
+ const kResponseStatus = Symbol ( 'kResponseStatus' ) ;
24
26
25
27
class PerformanceResourceTiming extends PerformanceEntry {
26
28
constructor ( skipThrowSymbol = undefined , name = undefined , type = undefined ) {
@@ -136,6 +138,16 @@ class PerformanceResourceTiming extends PerformanceEntry {
136
138
return this [ kTimingInfo ] . encodedBodySize + 300 ;
137
139
}
138
140
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
+
139
151
toJSON ( ) {
140
152
validateInternalField ( this , kInitiatorType , 'PerformanceResourceTiming' ) ;
141
153
return {
@@ -160,6 +172,8 @@ class PerformanceResourceTiming extends PerformanceEntry {
160
172
transferSize : this . transferSize ,
161
173
encodedBodySize : this . encodedBodySize ,
162
174
decodedBodySize : this . decodedBodySize ,
175
+ deliveryType : this . deliveryType ,
176
+ responseStatus : this . responseStatus ,
163
177
} ;
164
178
}
165
179
}
@@ -182,6 +196,8 @@ ObjectDefineProperties(PerformanceResourceTiming.prototype, {
182
196
transferSize : kEnumerableProperty ,
183
197
encodedBodySize : kEnumerableProperty ,
184
198
decodedBodySize : kEnumerableProperty ,
199
+ deliveryType : kEnumerableProperty ,
200
+ responseStatus : kEnumerableProperty ,
185
201
toJSON : kEnumerableProperty ,
186
202
[ SymbolToStringTag ] : {
187
203
__proto__ : null ,
@@ -190,7 +206,15 @@ ObjectDefineProperties(PerformanceResourceTiming.prototype, {
190
206
} ,
191
207
} ) ;
192
208
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
+ ) {
194
218
const resourceTiming = new PerformanceResourceTiming ( kSkipThrow , requestedUrl , 'resource' ) ;
195
219
196
220
resourceTiming [ kInitiatorType ] = initiatorType ;
@@ -200,6 +224,8 @@ function createPerformanceResourceTiming(requestedUrl, initiatorType, timingInfo
200
224
// The spec doesn't say to validate it in the class construction.
201
225
resourceTiming [ kTimingInfo ] = timingInfo ;
202
226
resourceTiming [ kCacheMode ] = cacheMode ;
227
+ resourceTiming [ kDeliveryType ] = deliveryType ;
228
+ resourceTiming [ kResponseStatus ] = responseStatus ;
203
229
204
230
return resourceTiming ;
205
231
}
@@ -211,6 +237,9 @@ function markResourceTiming(
211
237
initiatorType ,
212
238
global ,
213
239
cacheMode ,
240
+ bodyInfo ,
241
+ responseStatus ,
242
+ deliveryType = '' ,
214
243
) {
215
244
// https://w3c.github.io/resource-timing/#dfn-setup-the-resource-timing-entry
216
245
assert (
@@ -222,6 +251,9 @@ function markResourceTiming(
222
251
initiatorType ,
223
252
timingInfo ,
224
253
cacheMode ,
254
+ bodyInfo ,
255
+ responseStatus ,
256
+ deliveryType ,
225
257
) ;
226
258
227
259
enqueue ( resource ) ;
0 commit comments