mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #23310 - KaczuH:add-domain-lookup-start, r=jdm
Add domain_lookup_start functionality <!-- Please describe your changes on the following line: --> Added the domain_lookup_start functionality in http_loader.rs (http_redirect_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21259 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23310) <!-- Reviewable:end -->
This commit is contained in:
commit
489ff5e932
6 changed files with 20 additions and 18 deletions
|
@ -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();
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue