mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Wait for the root pipeline to become ready before running webdriver commands.
This commit is contained in:
parent
28ac0abf6a
commit
98cb65ca0a
1 changed files with 19 additions and 6 deletions
|
@ -76,12 +76,25 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_root_pipeline(&self) -> PipelineId {
|
fn get_root_pipeline(&self) -> WebDriverResult<PipelineId> {
|
||||||
let (sender, reciever) = channel();
|
let interval = Duration::milliseconds(20);
|
||||||
let ConstellationChan(ref const_chan) = self.constellation_chan;
|
let iterations = 30_000 / interval.num_milliseconds();
|
||||||
const_chan.send(ConstellationMsg::GetRootPipeline(sender)).unwrap();
|
|
||||||
|
|
||||||
reciever.recv().unwrap().unwrap()
|
for _ in 0..iterations {
|
||||||
|
let (sender, reciever) = channel();
|
||||||
|
let ConstellationChan(ref const_chan) = self.constellation_chan;
|
||||||
|
const_chan.send(ConstellationMsg::GetRootPipeline(sender)).unwrap();
|
||||||
|
|
||||||
|
|
||||||
|
if let Some(x) = reciever.recv().unwrap() {
|
||||||
|
return Ok(x);
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep(interval)
|
||||||
|
};
|
||||||
|
|
||||||
|
Err(WebDriverError::new(ErrorStatus::Timeout,
|
||||||
|
"Failed to get root window handle"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_new_session(&mut self) -> WebDriverResult<WebDriverResponse> {
|
fn handle_new_session(&mut self) -> WebDriverResult<WebDriverResponse> {
|
||||||
|
@ -109,7 +122,7 @@ impl Handler {
|
||||||
"Invalid URL"))
|
"Invalid URL"))
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline_id = self.get_root_pipeline();
|
let pipeline_id = try!(self.get_root_pipeline());
|
||||||
|
|
||||||
let (sender, reciever) = channel();
|
let (sender, reciever) = channel();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue