mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement WebDriver Refresh command
This commit is contained in:
parent
9eade19897
commit
f28219b8cb
3 changed files with 56 additions and 22 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue