Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWebdriver panics when there isn't a root page #11117
Comments
|
OK, diagnosis... When script runs fn SetHref(&self, value: USVString) {
if let Ok(url) = self.window.get_url().join(&value.0) {
self.window.load_url(url);
}
}which in turn calls pub fn load_url(&self, url: Url) {
let doc = self.Document();
self.main_thread_script_chan().send(
MainThreadScriptMsg::Navigate(self.id,
LoadData::new(url, doc.get_referrer_policy(), Some(doc.url().clone())))).unwrap();
}this sends a fn handle_navigate(&self, pipeline_id: PipelineId, subpage_id: Option<SubpageId>, load_data: LoadData) {
...
match subpage_id {
Some(subpage_id) => ...
None => {
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data)).unwrap();
}
}
}and sends a Now, when a webdriver command arrives, it gets routed to the current pipeline by fn root_pipeline(&self) -> WebDriverResult<PipelineId> {
let interval = 20;
let iterations = 30_000 / interval;
for _ in 0..iterations {
if let Some(x) = self.pipeline(None) {
return Ok(x)
};
thread::sleep(Duration::from_millis(interval));
};
Err(WebDriverError::new(ErrorStatus::Timeout,
"Failed to get root window handle"))
}where fn pipeline(&self, frame_id: Option<FrameId>) -> Option<PipelineId> {
let (sender, receiver) = ipc::channel().unwrap();
self.constellation_chan.send(ConstellationMsg::GetPipeline(frame_id, sender)).unwrap();
receiver.recv().unwrap()
}and the constellation's handler for fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
resp_chan: IpcSender<Option<PipelineId>>) {
let current_pipeline_id = frame_id.or(self.root_frame_id)
.and_then(|frame_id| self.frames.get(&frame_id))
.map(|frame| frame.current);
let pipeline_id = self.pending_frames.iter().rev()
.find(|x| x.old_pipeline_id == current_pipeline_id)
.map(|x| x.new_pipeline_id).or(current_pipeline_id);
if let Err(e) = resp_chan.send(pipeline_id) {
warn!("Failed get_pipeline response ({}).", e);
}
}so there is nothing waiting for the pipeline's page to finish loading before executing the command. In particular, this might be a script command, which gets routed to a script thread without a root page, and boom. |
|
IRC conversation with @jdm and @jgraham: http://logs.glob.uno/?c=mozilla%23servo&s=11+May+2016&e=11+May+2016#c426947 |
|
More IRC conversation with @jdm http://logs.glob.uno/?c=mozilla%23servo&s=11+May+2016&e=11+May+2016#c427101 |
|
Summarizing the IRC conversation... the only way we can get a pipeline without a page is for |
…t-ready, r=jgraham When webdriver is getting a pipeline id, it should wait for the pipeline document to be ready Thank you for contributing to Servo! Please add an `X` inside each `[ ]` when the step is complete, and replace `__` with appropriate data: - [X] `./mach build` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11117 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [X] These changes do not require tests because they only impact webdriver Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11140) <!-- Reviewable:end -->
…t-ready, r=jgraham When webdriver is getting a pipeline id, it should wait for the pipeline document to be ready Thank you for contributing to Servo! Please add an `X` inside each `[ ]` when the step is complete, and replace `__` with appropriate data: - [X] `./mach build` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11117 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [X] These changes do not require tests because they only impact webdriver Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11140) <!-- Reviewable:end -->
Running webdriver test https://github.com/w3c/web-platform-tests/blob/master/webdriver/navigation.py#L115 on Servo causes panic:
The root cause is https://github.com/servo/servo/blob/master/components/script/script_thread.rs#L995, which calls
self.root_page()when a webdriver message arrives, generating a panic if there isn't a root page yet. (Navigation can cause a fresh script thread to be created, with root page initialized atNone.)cc @jgraham