mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Expose stub attributes on PerformanceResourceTiming
The purpose of this commit is to expose stub attributes on PerformanceResourceTiming in order to enable tests to pass as well as set the type of performance timing entry to navigation when the initiator is navigation. The purpose of this is to ensure that document performance entries are correctly classified as navigation entries rather than resource entries.
This commit is contained in:
parent
7596c36959
commit
f5c2e13359
2 changed files with 47 additions and 9 deletions
|
@ -50,9 +50,9 @@ pub struct PerformanceResourceTiming {
|
|||
request_start: f64,
|
||||
response_start: f64,
|
||||
response_end: f64,
|
||||
// transfer_size: f64, //size in octets
|
||||
// encoded_body_size: f64, //size in octets
|
||||
// decoded_body_size: f64, //size in octets
|
||||
transfer_size: u64, //size in octets
|
||||
encoded_body_size: u64, //size in octets
|
||||
decoded_body_size: u64, //size in octets
|
||||
}
|
||||
|
||||
// TODO(#21254): startTime
|
||||
|
@ -71,10 +71,15 @@ impl PerformanceResourceTiming {
|
|||
next_hop: Option<DOMString>,
|
||||
fetch_start: f64,
|
||||
) -> PerformanceResourceTiming {
|
||||
let entry_type = if initiator_type == InitiatorType::Navigation {
|
||||
DOMString::from("navigation")
|
||||
} else {
|
||||
DOMString::from("resource")
|
||||
};
|
||||
PerformanceResourceTiming {
|
||||
entry: PerformanceEntry::new_inherited(
|
||||
DOMString::from(url.into_string()),
|
||||
DOMString::from("resource"),
|
||||
entry_type,
|
||||
0.,
|
||||
0.,
|
||||
),
|
||||
|
@ -92,6 +97,9 @@ impl PerformanceResourceTiming {
|
|||
request_start: 0.,
|
||||
response_start: 0.,
|
||||
response_end: 0.,
|
||||
transfer_size: 0,
|
||||
encoded_body_size: 0,
|
||||
decoded_body_size: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,13 +125,18 @@ impl PerformanceResourceTiming {
|
|||
redirect_end: resource_timing.redirect_end as f64,
|
||||
fetch_start: resource_timing.fetch_start as f64,
|
||||
domain_lookup_start: resource_timing.domain_lookup_start as f64,
|
||||
//TODO (#21260)
|
||||
domain_lookup_end: 0.,
|
||||
connect_start: resource_timing.connect_start as f64,
|
||||
connect_end: resource_timing.connect_end as f64,
|
||||
// TODO (#21271)
|
||||
secure_connection_start: 0.,
|
||||
request_start: resource_timing.request_start as f64,
|
||||
response_start: resource_timing.response_start as f64,
|
||||
response_end: resource_timing.response_end as f64,
|
||||
transfer_size: 0,
|
||||
encoded_body_size: 0,
|
||||
decoded_body_size: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,6 +188,31 @@ impl PerformanceResourceTimingMethods for PerformanceResourceTiming {
|
|||
Finite::wrap(self.domain_lookup_start)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-domainlookupend
|
||||
fn DomainLookupEnd(&self) -> DOMHighResTimeStamp {
|
||||
Finite::wrap(self.domain_lookup_end)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-secureconnectionstart
|
||||
fn SecureConnectionStart(&self) -> DOMHighResTimeStamp {
|
||||
Finite::wrap(self.secure_connection_start)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize
|
||||
fn TransferSize(&self) -> u64 {
|
||||
self.transfer_size
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-encodedbodysize
|
||||
fn EncodedBodySize(&self) -> u64 {
|
||||
self.encoded_body_size
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-decodedbodysize
|
||||
fn DecodedBodySize(&self) -> u64 {
|
||||
self.decoded_body_size
|
||||
}
|
||||
|
||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-requeststart
|
||||
fn RequestStart(&self) -> DOMHighResTimeStamp {
|
||||
Finite::wrap(self.request_start)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue