refactored performance timing to align with updated spec

refactoring with ResourceFetchMetadata

implemented deprecated window.timing functionality

created ResourceTimingListener trait

fixed w3c links in navigation timing

updated include.ini to run resource timing tests on ci
This commit is contained in:
ddh 2018-03-12 22:24:41 +00:00
parent 3fe83f1d06
commit 26007fddd3
103 changed files with 1881 additions and 322 deletions

View file

@ -356,6 +356,8 @@ pub struct Document {
top_level_dom_complete: Cell<u64>,
load_event_start: Cell<u64>,
load_event_end: Cell<u64>,
unload_event_start: Cell<u64>,
unload_event_end: Cell<u64>,
/// <https://html.spec.whatwg.org/multipage/#concept-document-https-state>
https_state: Cell<HttpsState>,
/// The document's origin.
@ -406,6 +408,8 @@ pub struct Document {
fired_unload: Cell<bool>,
/// List of responsive images
responsive_images: DomRefCell<Vec<Dom<HTMLImageElement>>>,
/// Number of redirects for the document load
redirect_count: Cell<u16>,
}
#[derive(JSTraceable, MallocSizeOf)]
@ -2290,6 +2294,14 @@ impl Document {
self.load_event_end.get()
}
pub fn get_unload_event_start(&self) -> u64 {
self.unload_event_start.get()
}
pub fn get_unload_event_end(&self) -> u64 {
self.unload_event_end.get()
}
pub fn start_tti(&self) {
if self.get_interactive_metrics().needs_tti() {
self.tti_window.borrow_mut().start_window();
@ -2654,6 +2666,8 @@ impl Document {
top_level_dom_complete: Cell::new(Default::default()),
load_event_start: Cell::new(Default::default()),
load_event_end: Cell::new(Default::default()),
unload_event_start: Cell::new(Default::default()),
unload_event_end: Cell::new(Default::default()),
https_state: Cell::new(HttpsState::None),
origin: origin,
referrer: referrer,
@ -2674,6 +2688,7 @@ impl Document {
salvageable: Cell::new(true),
fired_unload: Cell::new(false),
responsive_images: Default::default(),
redirect_count: Cell::new(0),
}
}
@ -2739,6 +2754,14 @@ impl Document {
document
}
pub fn get_redirect_count(&self) -> u16 {
self.redirect_count.get()
}
pub fn set_redirect_count(&self, count: u16) {
self.redirect_count.set(count)
}
fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> {
let doc = self.GetDocumentElement();
let maybe_node = doc.r().map(Castable::upcast::<Node>);
@ -4268,6 +4291,9 @@ impl DocumentMethods for Document {
return Ok(DomRoot::from_ref(self));
}
// TODO: prompt to unload.
// TODO: set unload_event_start and unload_event_end
window_from_node(self).set_navigation_start();
// Step 7