Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
handle early LoadURL messages without panicking by sending initial ur…
…l load

fixes #6126
  • Loading branch information
Mike Blumenkrantz committed May 27, 2015
1 parent aef3218 commit 64ff2c4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions components/compositing/compositor.rs
Expand Up @@ -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()
}
Expand Down

0 comments on commit 64ff2c4

Please sign in to comment.