aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/net/http_loader.rs6
-rw-r--r--components/net_traits/lib.rs4
-rw-r--r--components/script/dom/performanceresourcetiming.rs9
-rw-r--r--components/script/dom/webidls/PerformanceResourceTiming.webidl2
-rw-r--r--tests/wpt/metadata/resource-timing/idlharness.any.js.ini12
-rw-r--r--tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini5
6 files changed, 20 insertions, 18 deletions
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index e081832b272..3080221f356 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -378,6 +378,12 @@ fn obtain_response(
},
}
+ context
+ .timing
+ .lock()
+ .unwrap()
+ .set_attribute(ResourceAttribute::DomainLookupStart);
+
// TODO(#21261) connect_start: set if a persistent connection is *not* used and the last non-redirected
// fetch passes the timing allow check
let connect_start = precise_time_ms();
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index c2cba5a0356..566a3e1093a 100644
--- a/components/net_traits/lib.rs
+++ b/components/net_traits/lib.rs
@@ -441,6 +441,7 @@ pub struct ResourceCorsData {
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ResourceFetchTiming {
+ pub domain_lookup_start: u64,
pub timing_type: ResourceTimingType,
/// Number of redirects until final resource (currently limited to 20)
pub redirect_count: u16,
@@ -462,6 +463,7 @@ pub enum RedirectStartValue {
pub enum ResourceAttribute {
RedirectCount(u16),
+ DomainLookupStart,
RequestStart,
ResponseStart,
RedirectStart(RedirectStartValue),
@@ -483,6 +485,7 @@ impl ResourceFetchTiming {
pub fn new(timing_type: ResourceTimingType) -> ResourceFetchTiming {
ResourceFetchTiming {
timing_type: timing_type,
+ domain_lookup_start: 0,
redirect_count: 0,
request_start: 0,
response_start: 0,
@@ -498,6 +501,7 @@ impl ResourceFetchTiming {
// time origin (as described in Performance::now)
pub fn set_attribute(&mut self, attribute: ResourceAttribute) {
match attribute {
+ ResourceAttribute::DomainLookupStart => self.domain_lookup_start = precise_time_ns(),
ResourceAttribute::RedirectCount(count) => self.redirect_count = count,
ResourceAttribute::RequestStart => self.request_start = precise_time_ns(),
ResourceAttribute::ResponseStart => self.response_start = precise_time_ns(),
diff --git a/components/script/dom/performanceresourcetiming.rs b/components/script/dom/performanceresourcetiming.rs
index 0c7df4d4f80..2457e4f23ba 100644
--- a/components/script/dom/performanceresourcetiming.rs
+++ b/components/script/dom/performanceresourcetiming.rs
@@ -86,8 +86,8 @@ impl PerformanceResourceTiming {
redirect_start: 0.,
redirect_end: 0.,
fetch_start: fetch_start,
- domain_lookup_start: 0.,
domain_lookup_end: 0.,
+ domain_lookup_start: 0.,
connect_start: 0.,
connect_end: 0.,
secure_connection_start: 0.,
@@ -118,7 +118,7 @@ impl PerformanceResourceTiming {
redirect_start: resource_timing.redirect_start as f64,
redirect_end: 0.,
fetch_start: resource_timing.fetch_start as f64,
- domain_lookup_start: 0.,
+ domain_lookup_start: resource_timing.domain_lookup_start as f64,
domain_lookup_end: 0.,
connect_start: resource_timing.connect_start as f64,
connect_end: resource_timing.connect_end as f64,
@@ -172,6 +172,11 @@ impl PerformanceResourceTimingMethods for PerformanceResourceTiming {
}
}
+ // https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-domainlookupstart
+ fn DomainLookupStart(&self) -> DOMHighResTimeStamp {
+ Finite::wrap(self.domain_lookup_start)
+ }
+
// 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 1c9cf1bb8e5..087db5f45cd 100644
--- a/components/script/dom/webidls/PerformanceResourceTiming.webidl
+++ b/components/script/dom/webidls/PerformanceResourceTiming.webidl
@@ -15,7 +15,7 @@ interface PerformanceResourceTiming : PerformanceEntry {
readonly attribute DOMHighResTimeStamp redirectStart;
// readonly attribute DOMHighResTimeStamp redirectEnd;
readonly attribute DOMHighResTimeStamp fetchStart;
- // readonly attribute DOMHighResTimeStamp domainLookupStart;
+ readonly attribute DOMHighResTimeStamp domainLookupStart;
// readonly attribute DOMHighResTimeStamp domainLookupEnd;
readonly attribute DOMHighResTimeStamp connectStart;
readonly attribute DOMHighResTimeStamp connectEnd;
diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini
index 9a66523e3e4..d96d2f8262d 100644
--- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini
+++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini
@@ -41,15 +41,9 @@
[PerformanceResourceTiming interface: resource must inherit property "secureConnectionStart" with the proper type]
expected: FAIL
- [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type]
- expected: FAIL
-
[PerformanceResourceTiming interface: attribute workerStart]
expected: FAIL
- [PerformanceResourceTiming interface: attribute domainLookupStart]
- expected: FAIL
-
[PerformanceResourceTiming interface: resource must inherit property "redirectEnd" with the proper type]
expected: FAIL
@@ -82,9 +76,6 @@
[PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type]
expected: FAIL
- [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type]
- expected: FAIL
-
[PerformanceResourceTiming interface: attribute decodedBodySize]
expected: FAIL
@@ -115,9 +106,6 @@
[PerformanceResourceTiming interface: attribute workerStart]
expected: FAIL
- [PerformanceResourceTiming interface: attribute domainLookupStart]
- expected: FAIL
-
[PerformanceResourceTiming interface: attribute redirectEnd]
expected: FAIL
diff --git a/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini b/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini
index 6f0d5cc1463..6a1505b3e12 100644
--- a/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini
+++ b/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini
@@ -2,14 +2,13 @@
[secureConnectionStart should be 0 in cross-origin request.]
expected: FAIL
- [domainLookupStart should be 0 in cross-origin request.]
- expected: FAIL
-
[domainLookupEnd should be 0 in cross-origin request.]
expected: FAIL
[redirectEnd should be 0 in cross-origin request.]
expected: FAIL
+ [domainLookupStart should be 0 in cross-origin request.]
+ expected: PASS
[connectEnd should be 0 in cross-origin request.]
expected: FAIL