mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
handle early LoadURL messages without panicking by sending initial url load
fixes #6126
This commit is contained in:
parent
aef3218169
commit
64ff2c4a54
1 changed files with 4 additions and 6 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue