script: Unify LoadComplete and DOMLoad messages.

See the PR in which this commit landed and also
https://github.com/servo/servo/pull/6415#issuecomment-122294169
This commit is contained in:
Emilio Cobos Álvarez 2016-07-27 10:34:36 -07:00
parent 572b3c31bd
commit 36376461f4
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 10 additions and 25 deletions

View file

@ -828,11 +828,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got load complete message");
self.handle_load_complete_msg(pipeline_id)
}
// The DOM load event fired on a document
FromScriptMsg::DOMLoad(pipeline_id) => {
debug!("constellation got dom load message");
self.handle_dom_load(pipeline_id)
}
// Handle a forward or back request
FromScriptMsg::TraverseHistory(pipeline_id, direction) => {
debug!("constellation got traverse history message from script");
@ -1438,16 +1433,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
fn handle_load_complete_msg(&mut self, pipeline_id: PipelineId) {
if let Some(frame_id) = self.get_top_level_frame_for_pipeline(Some(pipeline_id)) {
let forward = !self.joint_session_future(frame_id).is_empty();
let back = !self.joint_session_past(frame_id).is_empty();
let root = self.root_frame_id.is_none() || self.root_frame_id == Some(frame_id);
self.compositor_proxy.send(ToCompositorMsg::LoadComplete(back, forward, root));
}
self.handle_subframe_loaded(pipeline_id);
}
fn handle_dom_load(&mut self, pipeline_id: PipelineId) {
let mut webdriver_reset = false;
if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel {
debug!("Sending load to WebDriver");
@ -1459,6 +1444,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
if webdriver_reset {
self.webdriver.load_channel = None;
}
if let Some(frame_id) = self.get_top_level_frame_for_pipeline(Some(pipeline_id)) {
let forward = !self.joint_session_future(frame_id).is_empty();
let back = !self.joint_session_past(frame_id).is_empty();
let root = self.root_frame_id.is_none() || self.root_frame_id == Some(frame_id);
self.compositor_proxy.send(ToCompositorMsg::LoadComplete(back, forward, root));
}
self.handle_subframe_loaded(pipeline_id);
}
fn handle_traverse_history_msg(&mut self,