Implement WebDriver Refresh command

This commit is contained in:
James Graham 2015-06-15 14:35:36 +01:00
parent 9eade19897
commit f28219b8cb
3 changed files with 56 additions and 22 deletions

View file

@ -912,14 +912,18 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// and pass the event to that script task.
match msg {
WebDriverCommandMsg::LoadUrl(pipeline_id, load_data, reply) => {
let new_pipeline_id = self.load_url(pipeline_id, load_data);
if let Some(id) = new_pipeline_id {
self.webdriver.load_channel = Some((id, reply));
}
self.load_url_for_webdriver(pipeline_id, load_data, reply);
},
WebDriverCommandMsg::GetUrl(pipeline_id, reply) => {
let pipeline = self.pipeline(pipeline_id);
reply.send(pipeline.url.clone()).unwrap();
},
WebDriverCommandMsg::Refresh(pipeline_id, reply) => {
let load_data = {
let pipeline = self.pipeline(pipeline_id);
LoadData::new(pipeline.url.clone())
};
self.load_url_for_webdriver(pipeline_id, load_data, reply);
}
WebDriverCommandMsg::ScriptCommand(pipeline_id, cmd) => {
let pipeline = self.pipeline(pipeline_id);
@ -941,6 +945,16 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}
fn load_url_for_webdriver(&mut self,
pipeline_id: PipelineId,
load_data:LoadData,
reply: Sender<webdriver_msg::LoadStatus>) {
let new_pipeline_id = self.load_url(pipeline_id, load_data);
if let Some(id) = new_pipeline_id {
self.webdriver.load_channel = Some((id, reply));
}
}
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
// If the currently focused pipeline is the one being changed (or a child