handle early LoadURL messages without panicking by sending initial url load

fixes #6126
This commit is contained in:
Mike Blumenkrantz 2015-05-26 18:52:54 -04:00
parent aef3218169
commit 64ff2c4a54

View file

@ -882,15 +882,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn on_load_url_window_event(&mut self, url_string: String) {
debug!("osmain: loading URL `{}`", url_string);
self.got_load_complete_message = false;
let root_pipeline_id = match self.scene.root {
Some(ref layer) => layer.get_pipeline_id(),
None => panic!("Compositor: Received WindowEvent::LoadUrl without initialized compositor \
layers"),
};
let url = Url::parse(&url_string).unwrap();
self.window.set_page_url(url.clone());
let msg = match self.scene.root {
Some(ref layer) => ConstellationMsg::LoadUrl(layer.get_pipeline_id(), LoadData::new(url)),
None => ConstellationMsg::InitLoadUrl(url)
};
let msg = ConstellationMsg::LoadUrl(root_pipeline_id, LoadData::new(url));
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(msg).unwrap()
}