From a11684460d2f6a062f42a4d43fc3adceeb58f17b Mon Sep 17 00:00:00 2001 From: Tomek LECOCQ Date: Fri, 3 May 2019 21:45:10 +0200 Subject: [PATCH 1/5] Add connectStart in PerformanceResourceTiming --- components/net/http_loader.rs | 6 ++++++ components/net_traits/lib.rs | 5 ++++- components/script/dom/performanceresourcetiming.rs | 7 ++++++- .../script/dom/webidls/PerformanceResourceTiming.webidl | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 3f9f9f46f0a..6574623232d 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -381,6 +381,12 @@ fn obtain_response( // 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(); + context + .timing + .lock() + .unwrap() + .set_attribute(ResourceAttribute::ConnectStart(connect_start)); + // https://url.spec.whatwg.org/#percent-encoded-bytes let request = HyperRequest::builder() .method(method) diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 74234cd9c57..188857e5adb 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -452,7 +452,7 @@ pub struct ResourceFetchTiming { pub response_end: u64, pub redirect_start: u64, // pub redirect_end: u64, - // pub connect_start: u64, + pub connect_start: u64, pub connect_end: u64, } @@ -468,6 +468,7 @@ pub enum ResourceAttribute { ResponseStart, RedirectStart(RedirectStartValue), FetchStart, + ConnectStart(u64), ConnectEnd(u64), ResponseEnd, } @@ -489,6 +490,7 @@ impl ResourceFetchTiming { response_start: 0, fetch_start: 0, redirect_start: 0, + connect_start: 0, connect_end: 0, response_end: 0, } @@ -510,6 +512,7 @@ impl ResourceFetchTiming { }, }, ResourceAttribute::FetchStart => self.fetch_start = precise_time_ns(), + ResourceAttribute::ConnectStart(val) => self.connect_start = val, ResourceAttribute::ConnectEnd(val) => self.connect_end = val, ResourceAttribute::ResponseEnd => self.response_end = precise_time_ns(), } diff --git a/components/script/dom/performanceresourcetiming.rs b/components/script/dom/performanceresourcetiming.rs index 9726f2c04e4..0c7df4d4f80 100644 --- a/components/script/dom/performanceresourcetiming.rs +++ b/components/script/dom/performanceresourcetiming.rs @@ -120,7 +120,7 @@ impl PerformanceResourceTiming { fetch_start: resource_timing.fetch_start as f64, domain_lookup_start: 0., domain_lookup_end: 0., - connect_start: 0., + connect_start: resource_timing.connect_start as f64, connect_end: resource_timing.connect_end as f64, secure_connection_start: 0., request_start: resource_timing.request_start as f64, @@ -192,6 +192,11 @@ impl PerformanceResourceTimingMethods for PerformanceResourceTiming { Finite::wrap(self.fetch_start) } + // https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-connectstart + fn ConnectStart(&self) -> DOMHighResTimeStamp { + Finite::wrap(self.connect_start) + } + // https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-connectend fn ConnectEnd(&self) -> DOMHighResTimeStamp { Finite::wrap(self.connect_end) diff --git a/components/script/dom/webidls/PerformanceResourceTiming.webidl b/components/script/dom/webidls/PerformanceResourceTiming.webidl index 9fdd9c845da..1c9cf1bb8e5 100644 --- a/components/script/dom/webidls/PerformanceResourceTiming.webidl +++ b/components/script/dom/webidls/PerformanceResourceTiming.webidl @@ -17,7 +17,7 @@ interface PerformanceResourceTiming : PerformanceEntry { readonly attribute DOMHighResTimeStamp fetchStart; // readonly attribute DOMHighResTimeStamp domainLookupStart; // readonly attribute DOMHighResTimeStamp domainLookupEnd; - // readonly attribute DOMHighResTimeStamp connectStart; + readonly attribute DOMHighResTimeStamp connectStart; readonly attribute DOMHighResTimeStamp connectEnd; // readonly attribute DOMHighResTimeStamp secureConnectionStart; readonly attribute DOMHighResTimeStamp requestStart; From 445faa1061c7c77769ad4469ac499114324b4ba1 Mon Sep 17 00:00:00 2001 From: Tomek LECOCQ Date: Sun, 5 May 2019 13:38:02 +0200 Subject: [PATCH 2/5] Modify tests for connectStart --- .../metadata/resource-timing/idlharness.any.js.ini | 12 ------------ .../resource-timing/resource_TAO_zero.htm.ini | 3 --- 2 files changed, 15 deletions(-) diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini index d5afd6d78d9..b05af809703 100644 --- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini +++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini @@ -44,18 +44,12 @@ [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type] expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "connectStart" with the proper type] - expected: FAIL - [PerformanceResourceTiming interface: attribute workerStart] expected: FAIL [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL - [PerformanceResourceTiming interface: attribute connectStart] - expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "redirectEnd" with the proper type] expected: FAIL @@ -97,9 +91,6 @@ [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type] expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "connectStart" with the proper type] - expected: FAIL - [PerformanceResourceTiming interface: attribute decodedBodySize] expected: FAIL @@ -157,9 +148,6 @@ [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL - [PerformanceResourceTiming interface: attribute connectStart] - 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 fe102191c74..191e465e85c 100644 --- a/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini +++ b/tests/wpt/metadata/resource-timing/resource_TAO_zero.htm.ini @@ -11,9 +11,6 @@ [domainLookupStart should be 0 in cross-origin request.] expected: FAIL - [connectStart should be 0 in cross-origin request.] - expected: FAIL - [redirectStart should be 0 in cross-origin request.] expected: PASS From 70c8bb083d9e782af2ab1bcfc40a12a1b61033d7 Mon Sep 17 00:00:00 2001 From: Tomek LECOCQ Date: Wed, 8 May 2019 12:51:58 +0200 Subject: [PATCH 3/5] Fix failing tests --- tests/wpt/metadata/resource-timing/idlharness.any.js.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini index b05af809703..ea0fb51ae63 100644 --- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini +++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini @@ -91,6 +91,9 @@ [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type] expected: FAIL + [PerformanceResourceTiming interface: resource must inherit property "connectStart" with the proper type] + expected: FAIL + [PerformanceResourceTiming interface: attribute decodedBodySize] expected: FAIL @@ -148,6 +151,9 @@ [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL + [PerformanceResourceTiming interface: attribute connectStart] + expected: FAIL + [PerformanceResourceTiming interface: attribute redirectEnd] expected: FAIL From 3e96a094aeff8a6626e3e7f6a39be413bae6681b Mon Sep 17 00:00:00 2001 From: Tomek LECOCQ Date: Thu, 9 May 2019 21:28:07 +0200 Subject: [PATCH 4/5] Remove test result --- tests/wpt/metadata/resource-timing/idlharness.any.js.ini | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini index ea0fb51ae63..46f3c03ddc0 100644 --- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini +++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini @@ -44,12 +44,18 @@ [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type] expected: FAIL + [PerformanceResourceTiming interface: resource must inherit property "connectStart" with the proper type] + expected: FAIL + [PerformanceResourceTiming interface: attribute workerStart] expected: FAIL [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL + [PerformanceResourceTiming interface: attribute connectStart] + expected: FAIL + [PerformanceResourceTiming interface: resource must inherit property "redirectEnd" with the proper type] expected: FAIL @@ -151,9 +157,6 @@ [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL - [PerformanceResourceTiming interface: attribute connectStart] - expected: FAIL - [PerformanceResourceTiming interface: attribute redirectEnd] expected: FAIL From 4ca4ab8bf7fce9bce3d137dddda288ee51f1d282 Mon Sep 17 00:00:00 2001 From: Tomek LECOCQ Date: Thu, 9 May 2019 22:28:51 +0200 Subject: [PATCH 5/5] Remove passing tests expecting failure --- tests/wpt/metadata/resource-timing/idlharness.any.js.ini | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini index 46f3c03ddc0..1938b2ca3ff 100644 --- a/tests/wpt/metadata/resource-timing/idlharness.any.js.ini +++ b/tests/wpt/metadata/resource-timing/idlharness.any.js.ini @@ -44,18 +44,12 @@ [PerformanceResourceTiming interface: resource must inherit property "domainLookupStart" with the proper type] expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "connectStart" with the proper type] - expected: FAIL - [PerformanceResourceTiming interface: attribute workerStart] expected: FAIL [PerformanceResourceTiming interface: attribute domainLookupStart] expected: FAIL - [PerformanceResourceTiming interface: attribute connectStart] - expected: FAIL - [PerformanceResourceTiming interface: resource must inherit property "redirectEnd" with the proper type] expected: FAIL