aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-07-17 21:40:10 +0200
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-07-18 17:42:14 +0200
commitdb044bdbef7807cd16d38a16e24935e83614980a (patch)
tree2aec7aa47b0b94dafa37389dce10fd3a0d418f5c /components/script/script_thread.rs
parent66b9544d60289631638f7a07aca9da3700b99894 (diff)
downloadservo-db044bdbef7807cd16d38a16e24935e83614980a.tar.gz
servo-db044bdbef7807cd16d38a16e24935e83614980a.zip
Set navigation start value according to navigation timing spec
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 722bd2cda12..c5885e64ed0 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -113,7 +113,7 @@ use task_source::file_reading::FileReadingTaskSource;
use task_source::history_traversal::HistoryTraversalTaskSource;
use task_source::networking::NetworkingTaskSource;
use task_source::user_interaction::{UserInteractionTask, UserInteractionTaskSource};
-use time::Tm;
+use time::{get_time, precise_time_ns, Tm};
use url::Position;
use webdriver_handlers;
use webvr_traits::{WebVREvent, WebVRMsg};
@@ -158,6 +158,10 @@ struct InProgressLoad {
url: ServoUrl,
/// The origin for the document
origin: MutableOrigin,
+ /// Timestamp reporting the time when the browser started this load.
+ navigation_start: u64,
+ /// High res timestamp reporting the time when the browser started this load.
+ navigation_start_precise: f64,
}
impl InProgressLoad {
@@ -170,6 +174,7 @@ impl InProgressLoad {
window_size: Option<WindowSizeData>,
url: ServoUrl,
origin: MutableOrigin) -> InProgressLoad {
+ let current_time = get_time();
InProgressLoad {
pipeline_id: id,
browsing_context_id: browsing_context_id,
@@ -181,6 +186,8 @@ impl InProgressLoad {
is_visible: true,
url: url,
origin: origin,
+ navigation_start: (current_time.sec * 1000 + current_time.nsec as i64 / 1000000) as u64,
+ navigation_start_precise: precise_time_ns() as f64,
}
}
}
@@ -1809,8 +1816,7 @@ impl ScriptThread {
fn handle_iframe_load_event(&self,
parent_id: PipelineId,
browsing_context_id: BrowsingContextId,
- child_id: PipelineId)
- {
+ child_id: PipelineId) {
let iframe = self.documents.borrow().find_iframe(parent_id, browsing_context_id);
match iframe {
Some(iframe) => iframe.iframe_load_event_steps(child_id),
@@ -1958,6 +1964,8 @@ impl ScriptThread {
incomplete.parent_info,
incomplete.window_size,
origin,
+ incomplete.navigation_start,
+ incomplete.navigation_start_precise,
self.webvr_thread.clone());
// Initialize the browsing context for the window.