mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +00:00
#24468 call update_entry API from process_response_eof
This commit is contained in:
parent
baf2b6e4ab
commit
d25d658219
1 changed files with 14 additions and 3 deletions
|
@ -689,6 +689,8 @@ pub struct ParserContext {
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
/// timing data for this resource
|
/// timing data for this resource
|
||||||
resource_timing: ResourceFetchTiming,
|
resource_timing: ResourceFetchTiming,
|
||||||
|
/// pushed entry index
|
||||||
|
pushed_entry_index: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParserContext {
|
impl ParserContext {
|
||||||
|
@ -699,6 +701,7 @@ impl ParserContext {
|
||||||
id: id,
|
id: id,
|
||||||
url: url,
|
url: url,
|
||||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Navigation),
|
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Navigation),
|
||||||
|
pushed_entry_index: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -883,8 +886,16 @@ impl FetchResponseListener for ParserContext {
|
||||||
parser.parse_sync();
|
parser.parse_sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO only submit if this is the current document resource
|
//TODO only update if this is the current document resource
|
||||||
self.submit_resource_timing();
|
if let Some(pushed_index) = self.pushed_entry_index {
|
||||||
|
let document = &parser.document;
|
||||||
|
let performance_entry =
|
||||||
|
PerformanceNavigationTiming::new(&document.global(), 0, 0, &document);
|
||||||
|
document
|
||||||
|
.global()
|
||||||
|
.performance()
|
||||||
|
.update_entry(pushed_index, performance_entry.upcast::<PerformanceEntry>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
|
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
|
||||||
|
@ -910,7 +921,7 @@ impl FetchResponseListener for ParserContext {
|
||||||
//TODO nav_start and nav_start_precise
|
//TODO nav_start and nav_start_precise
|
||||||
let performance_entry =
|
let performance_entry =
|
||||||
PerformanceNavigationTiming::new(&document.global(), 0, 0, &document);
|
PerformanceNavigationTiming::new(&document.global(), 0, 0, &document);
|
||||||
document
|
self.pushed_entry_index = document
|
||||||
.global()
|
.global()
|
||||||
.performance()
|
.performance()
|
||||||
.queue_entry(performance_entry.upcast::<PerformanceEntry>());
|
.queue_entry(performance_entry.upcast::<PerformanceEntry>());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue