aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorJaved Nissar <javed.nissar@mail.utoronto.ca>2019-09-17 18:02:35 -0400
committerJaved Nissar <javed.nissar@mail.utoronto.ca>2019-09-23 22:52:12 -0400
commitf5c2e133595e677ee1789895921dc2052ac6830f (patch)
tree80622c084e5a888bb2523785472286cacfa5824d /components/script/dom
parent7596c36959c512f09190d5a3d412b624dcd37b73 (diff)
downloadservo-f5c2e133595e677ee1789895921dc2052ac6830f.tar.gz
servo-f5c2e133595e677ee1789895921dc2052ac6830f.zip
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.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/performanceresourcetiming.rs46
-rw-r--r--components/script/dom/webidls/PerformanceResourceTiming.webidl10
2 files changed, 47 insertions, 9 deletions
diff --git a/components/script/dom/performanceresourcetiming.rs b/components/script/dom/performanceresourcetiming.rs
index 5d755240458..7f4785ea4e4 100644
--- a/components/script/dom/performanceresourcetiming.rs
+++ b/components/script/dom/performanceresourcetiming.rs
@@ -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)
diff --git a/components/script/dom/webidls/PerformanceResourceTiming.webidl b/components/script/dom/webidls/PerformanceResourceTiming.webidl
index e4f73197a8c..50a6dba1416 100644
--- a/components/script/dom/webidls/PerformanceResourceTiming.webidl
+++ b/components/script/dom/webidls/PerformanceResourceTiming.webidl
@@ -16,15 +16,15 @@ interface PerformanceResourceTiming : PerformanceEntry {
readonly attribute DOMHighResTimeStamp redirectEnd;
readonly attribute DOMHighResTimeStamp fetchStart;
readonly attribute DOMHighResTimeStamp domainLookupStart;
- // readonly attribute DOMHighResTimeStamp domainLookupEnd;
+ readonly attribute DOMHighResTimeStamp domainLookupEnd;
readonly attribute DOMHighResTimeStamp connectStart;
readonly attribute DOMHighResTimeStamp connectEnd;
- // readonly attribute DOMHighResTimeStamp secureConnectionStart;
+ readonly attribute DOMHighResTimeStamp secureConnectionStart;
readonly attribute DOMHighResTimeStamp requestStart;
readonly attribute DOMHighResTimeStamp responseStart;
readonly attribute DOMHighResTimeStamp responseEnd;
- /// readonly attribute unsigned long long transferSize;
- /// readonly attribute unsigned long long encodedBodySize;
- /// readonly attribute unsigned long long decodedBodySize;
+ readonly attribute unsigned long long transferSize;
+ readonly attribute unsigned long long encodedBodySize;
+ readonly attribute unsigned long long decodedBodySize;
[Default] object toJSON();
};