diff options
author | Shinichi Morimoto <shnmorimoto@gmail.com> | 2019-12-08 02:25:58 +0900 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-12-13 13:41:48 -0500 |
commit | d25d658219d40e306bcd075d17aa33d1cceeb484 (patch) | |
tree | b7983ccf3c206344115fac6edad65ad9af096808 /components/script/dom/servoparser/mod.rs | |
parent | baf2b6e4abff06e224dbad5658762005e4f25f96 (diff) | |
download | servo-d25d658219d40e306bcd075d17aa33d1cceeb484.tar.gz servo-d25d658219d40e306bcd075d17aa33d1cceeb484.zip |
#24468 call update_entry API from process_response_eof
Diffstat (limited to 'components/script/dom/servoparser/mod.rs')
-rw-r--r-- | components/script/dom/servoparser/mod.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 6c8b8ede013..b968aa47274 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -689,6 +689,8 @@ pub struct ParserContext { url: ServoUrl, /// timing data for this resource resource_timing: ResourceFetchTiming, + /// pushed entry index + pushed_entry_index: Option<usize>, } impl ParserContext { @@ -699,6 +701,7 @@ impl ParserContext { id: id, url: url, resource_timing: ResourceFetchTiming::new(ResourceTimingType::Navigation), + pushed_entry_index: None, } } } @@ -883,8 +886,16 @@ impl FetchResponseListener for ParserContext { parser.parse_sync(); } - //TODO only submit if this is the current document resource - self.submit_resource_timing(); + //TODO only update if this is the current document resource + 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 { @@ -910,7 +921,7 @@ impl FetchResponseListener for ParserContext { //TODO nav_start and nav_start_precise let performance_entry = PerformanceNavigationTiming::new(&document.global(), 0, 0, &document); - document + self.pushed_entry_index = document .global() .performance() .queue_entry(performance_entry.upcast::<PerformanceEntry>()); |